Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/DebugUtils.java214
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/Logger.java270
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/exception/DebuggingRuntimeException.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Activator.java94
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/ErrorHandlingUtils.java100
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/JavaUtils.java108
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Messages.java68
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/AbstractRegistry.java220
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FileUtils.java384
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FolderUtils.java224
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/IFilter.java58
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/ListUtils.java66
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/StringUtils.java216
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/messages.properties34
14 files changed, 1062 insertions, 1062 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/DebugUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/DebugUtils.java
index a2f3405c281..aab36a924df 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/DebugUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/DebugUtils.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2011 Mia-Software.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public 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é - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.papyrus.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
- * Grégoire Dupé - Bug 367613 - Table widget refactoring
- * 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.papyrus.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);
- }
- }
-
- /**
- * 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);
- }
-
- public static void debug(final String message, final int stackOffset) {
- String location = getCallerLocation(stackOffset);
- System.out.println(location + ": " //$NON-NLS-1$
- + message);
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public 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é - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.papyrus.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Grégoire Dupé - Bug 367613 - Table widget refactoring
+ * 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.papyrus.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);
+ }
+ }
+
+ /**
+ * 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);
+ }
+
+ public static void debug(final String message, final int stackOffset) {
+ String location = getCallerLocation(stackOffset);
+ System.out.println(location + ": " //$NON-NLS-1$
+ + message);
+
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/Logger.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/Logger.java
index c26d79d7dee..4b8481dd4a2 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/Logger.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/Logger.java
@@ -1,135 +1,135 @@
-/*******************************************************************************
- * 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.papyrus.emf.facet.util.core
- * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.papyrus.emf.facet.util.core.Logger#log
- *******************************************************************************/
-package org.eclipse.papyrus.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.papyrus.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);
- }
-
- /**
- * 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;
- }
-
- 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$
- // }
- // }
-}
+/*******************************************************************************
+ * 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.papyrus.emf.facet.util.core
+ * Nicolas Bros (Mia-Software) - Bug 340031 - NPE in org.eclipse.papyrus.emf.facet.util.core.Logger#log
+ *******************************************************************************/
+package org.eclipse.papyrus.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.papyrus.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);
+ }
+
+ /**
+ * 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;
+ }
+
+ 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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/exception/DebuggingRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/exception/DebuggingRuntimeException.java
index c2d8eb48887..ba81b373745 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/exception/DebuggingRuntimeException.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/exception/DebuggingRuntimeException.java
@@ -1,34 +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.papyrus.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);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public 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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Activator.java
index f3310819cac..0eef053d027 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Activator.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Activator.java
@@ -1,47 +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.papyrus.emf.facet.util.core.Logger#log
- * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
- */
-package org.eclipse.papyrus.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.papyrus.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);
- }
-
-}
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public 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.papyrus.emf.facet.util.core.Logger#log
+ * Nicolas Guyomar (Mia-Software) - Bug 340339 - Need some Utils class for Folder/File/Project management
+ */
+package org.eclipse.papyrus.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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/ErrorHandlingUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/ErrorHandlingUtils.java
index 1fe1e254e20..6cf84ec77d5 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/ErrorHandlingUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/ErrorHandlingUtils.java
@@ -1,50 +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.papyrus.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();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public 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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/JavaUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/JavaUtils.java
index ffb6f2531ec..4fd7c3b8740 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/JavaUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/JavaUtils.java
@@ -1,54 +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.papyrus.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;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Mia-Software
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of 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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Messages.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Messages.java
index fb2e6811381..c5e36b9bd7a 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Messages.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/Messages.java
@@ -1,34 +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.papyrus.emf.facet.util.core.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-public final class Messages extends NLS {
- private static String BUNDLE_NAME = "org.eclipse.papyrus.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
- }
-}
+/*******************************************************************************
+ * 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.papyrus.emf.facet.util.core.internal;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class Messages extends NLS {
+ private static String BUNDLE_NAME = "org.eclipse.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/AbstractRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/AbstractRegistry.java
index 3d01603fa48..01f757cf0f3 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/AbstractRegistry.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/AbstractRegistry.java
@@ -1,110 +1,110 @@
-/*******************************************************************************
- * 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.papyrus.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.osgi.util.NLS;
-import org.eclipse.papyrus.emf.facet.util.core.Logger;
-import org.eclipse.papyrus.emf.facet.util.core.internal.Activator;
-import org.eclipse.papyrus.emf.facet.util.core.internal.Messages;
-
-/**
- * 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.papyrus.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());
- }
-}
+/*******************************************************************************
+ * 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.papyrus.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.osgi.util.NLS;
+import org.eclipse.papyrus.emf.facet.util.core.Logger;
+import org.eclipse.papyrus.emf.facet.util.core.internal.Activator;
+import org.eclipse.papyrus.emf.facet.util.core.internal.Messages;
+
+/**
+ * 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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FileUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FileUtils.java
index 8e4719c0411..bb87a1507b5 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FileUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FileUtils.java
@@ -1,192 +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.papyrus.emf.facet.util.core.internal.exported.FileUtils.copyFolderFromBundle
- *******************************************************************************/
-package org.eclipse.papyrus.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.papyrus.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;
- }
-}
+/*******************************************************************************
+ * 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.papyrus.emf.facet.util.core.internal.exported.FileUtils.copyFolderFromBundle
+ *******************************************************************************/
+package org.eclipse.papyrus.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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FolderUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FolderUtils.java
index 338a236cd7c..4c11cf01bdc 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FolderUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/FolderUtils.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * 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.papyrus.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.papyrus.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);
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * 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.papyrus.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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/IFilter.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/IFilter.java
index f7377d116ba..cba57b85df7 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/IFilter.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/IFilter.java
@@ -1,29 +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.papyrus.emf.facet.util.core.internal.exported;
-
-/**
- * @since 0.2
- */
-public interface IFilter<T> {
- // This class has been copied from org.eclipse.papyrus.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);
-
-}
+/*******************************************************************************
+ * 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.papyrus.emf.facet.util.core.internal.exported;
+
+/**
+ * @since 0.2
+ */
+public interface IFilter<T> {
+ // This class has been copied from org.eclipse.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/ListUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/ListUtils.java
index 1d0d60b654c..71f85b20fdb 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/ListUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/ListUtils.java
@@ -1,33 +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.papyrus.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;
- }
-}
+/*******************************************************************************
+ * 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.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/StringUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/StringUtils.java
index 76b401ae82d..34bb5788a32 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/StringUtils.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/exported/StringUtils.java
@@ -1,108 +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.papyrus.emf.facet.util.core.internal.exported;
-
-
-import org.eclipse.papyrus.emf.facet.util.core.internal.Messages;
-
-import com.ibm.icu.lang.UCharacter;
-
-/**
- * @author Gabriel Barbier
- * @since 0.2
- */
-// Copied from org.eclipse.papyrus.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();
- }
-}
+/*******************************************************************************
+ * 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.papyrus.emf.facet.util.core.internal.exported;
+
+
+import org.eclipse.papyrus.emf.facet.util.core.internal.Messages;
+
+import com.ibm.icu.lang.UCharacter;
+
+/**
+ * @author Gabriel Barbier
+ * @since 0.2
+ */
+// Copied from org.eclipse.papyrus.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/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/messages.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/messages.properties
index 1e93cb5dbc3..d8af3aecea4 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/messages.properties
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.core/src/org/eclipse/papyrus/emf/facet/util/core/internal/messages.properties
@@ -1,18 +1,18 @@
-###############################################################################
-# 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
-###############################################################################
-StringUtils_ellipsis=\u2026
-AbstractRegistry_colon=:
-AbstractRegistry_id=, id
-AbstractRegistry_pluginExtension=Plugin {0}.{1}
-AbstractRegistry_requiredAttributeNotDefined=Required attribute "{0}" is missing
+###############################################################################
+# 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
+###############################################################################
+StringUtils_ellipsis=\u2026
+AbstractRegistry_colon=:
+AbstractRegistry_id=, id
+AbstractRegistry_pluginExtension=Plugin {0}.{1}
+AbstractRegistry_requiredAttributeNotDefined=Required attribute "{0}" is missing
AbstractRegistry_unknownExtensionTag=Unknown extension tag found: {0} \ No newline at end of file

Back to the top