Skip to content
Snippets Groups Projects
Commit 5bdf6470 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Kernel cleanup => YELLOW

refs 311
parent 12d6a409
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.ecore.EObject;
......@@ -24,7 +26,6 @@ import org.fortiss.tooling.kernel.ToolingKernelActivator;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.ICommandStackService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
/**
* This class implements the {@link ICommandStackService} interface. This class
......@@ -33,7 +34,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 9419FA04EC4ABCDEE7575A87CB832C5F
* @ConQAT.Rating YELLOW Hash: 7597495197209C46729E2D1B92749E54
*/
public class CommandStackService implements ICommandStackService {
......@@ -114,7 +115,7 @@ public class CommandStackService implements ICommandStackService {
try {
context.doSave(monitor);
} catch (Exception e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Error while saving.", e);
}
}
......
......@@ -17,6 +17,11 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getBundle;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getConfigurationElements;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -38,8 +43,6 @@ import org.fortiss.tooling.kernel.extension.IStorageProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.service.listener.IPersistencyServiceListener;
import org.fortiss.tooling.kernel.utils.ExtensionPointUtils;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
import org.osgi.framework.Bundle;
/**
......@@ -49,7 +52,7 @@ import org.osgi.framework.Bundle;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: A05DB638DEDC3398170FC193467F9DA6
* @ConQAT.Rating YELLOW Hash: 4F70931B343453F4C70065EF91708C65
*/
public class PersistencyService implements IPersistencyService {
......@@ -116,10 +119,10 @@ public class PersistencyService implements IPersistencyService {
try {
context.doSave(monitor);
} catch (CoreException e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Error during save operation.", e);
} catch (IOException e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Error during save operation.", e);
}
}
......@@ -220,19 +223,17 @@ public class PersistencyService implements IPersistencyService {
/** Initializes the storage provider list from plugin extensions. */
private void setupStorageProviders() {
for (IConfigurationElement ce : ExtensionPointUtils
.getConfigurationElements(EXTENSION_POINT_NAME,
CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = ExtensionPointUtils.getBundle(ce);
for (IConfigurationElement ce : getConfigurationElements(
EXTENSION_POINT_NAME, CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = getBundle(ce);
try {
Class<?> handlerClass = ExtensionPointUtils.loadClass(
ce.getAttribute("provider"), bundle);
Class<?> handlerClass = loadClass(ce.getAttribute("provider"),
bundle);
IStorageProvider provider = (IStorageProvider) handlerClass
.getConstructor().newInstance();
storageProviderList.add(provider);
} catch (Exception ex) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
ex.getMessage(), ex);
error(ToolingKernelActivator.getDefault(), ex.getMessage(), ex);
}
}
}
......
......@@ -17,6 +17,11 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getBundle;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getConfigurationElements;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
......@@ -30,8 +35,6 @@ import org.fortiss.tooling.kernel.extension.IPrototypeProvider;
import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.service.IElementCompositorService;
import org.fortiss.tooling.kernel.service.IPrototypeService;
import org.fortiss.tooling.kernel.utils.ExtensionPointUtils;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
import org.osgi.framework.Bundle;
/**
......@@ -40,7 +43,7 @@ import org.osgi.framework.Bundle;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 4CA4C2CCC9C1B519A40EB842B6A3035E
* @ConQAT.Rating YELLOW Hash: 6262501760FEC27B55A2A328A4877741
*/
public class PrototypeService implements IPrototypeService {
......@@ -60,19 +63,17 @@ public class PrototypeService implements IPrototypeService {
/** Initializes the prototype list from plugin extensions. */
private void setupPrototypes() {
for (IConfigurationElement ce : ExtensionPointUtils
.getConfigurationElements(EXTENSION_POINT_NAME,
CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = ExtensionPointUtils.getBundle(ce);
for (IConfigurationElement ce : getConfigurationElements(
EXTENSION_POINT_NAME, CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = getBundle(ce);
try {
Class<?> handlerClass = ExtensionPointUtils.loadClass(
ce.getAttribute("provider"), bundle);
Class<?> handlerClass = loadClass(ce.getAttribute("provider"),
bundle);
IPrototypeProvider provider = (IPrototypeProvider) handlerClass
.getConstructor().newInstance();
prototypeProviderList.add(provider);
} catch (Exception ex) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
ex.getMessage(), ex);
error(ToolingKernelActivator.getDefault(), ex.getMessage(), ex);
}
}
}
......
......@@ -17,6 +17,11 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.storage.eclipse;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getBundle;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.getConfigurationElements;
import static org.fortiss.tooling.kernel.utils.ExtensionPointUtils.loadClass;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -45,8 +50,6 @@ import org.fortiss.tooling.kernel.extension.IStorageProvider;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.service.IEclipseResourceStorageService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.utils.ExtensionPointUtils;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
import org.osgi.framework.Bundle;
/**
......@@ -56,7 +59,7 @@ import org.osgi.framework.Bundle;
* @author hoelzlf
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 9AB0823B246FC76AE1593AA9B6888BF5
* @ConQAT.Rating YELLOW Hash: 3DCBF0F656CBD0DAE87FDCAA7CCBA86A
*/
public class EclipseResourceStorageProvider implements
IEclipseResourceStorageService, IResourceChangeListener,
......@@ -102,8 +105,7 @@ public class EclipseResourceStorageProvider implements
try {
loadContext(file);
} catch (IOException ioex) {
LoggingUtils.error(
ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"IO Exception while loading model file: "
+ file.getName(), ioex);
}
......@@ -111,7 +113,7 @@ public class EclipseResourceStorageProvider implements
}
}
} catch (CoreException e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Core Exception while scanning Eclipse workspace", e);
}
}
......@@ -140,8 +142,8 @@ public class EclipseResourceStorageProvider implements
try {
event.getDelta().accept(this);
} catch (final CoreException e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
"Should not happen!", e);
error(ToolingKernelActivator.getDefault(),
"Kernel Core Ecxeption!", e);
}
}
}
......@@ -170,8 +172,7 @@ public class EclipseResourceStorageProvider implements
try {
loadContext(file);
} catch (IOException ioex) {
LoggingUtils.error(
ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Had an error during reloading the file!",
ioex);
}
......@@ -185,11 +186,9 @@ public class EclipseResourceStorageProvider implements
try {
loadContext(file);
} catch (IOException ioex) {
LoggingUtils
.error(ToolingKernelActivator
.getDefault(),
"Had an error during reloading the file!",
ioex);
error(ToolingKernelActivator.getDefault(),
"Had an error during reloading the file!",
ioex);
}
}
}
......@@ -211,7 +210,7 @@ public class EclipseResourceStorageProvider implements
try {
loadContext(file);
} catch (final Exception e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Had an error during reloading the file!", e);
}
}
......@@ -249,19 +248,17 @@ public class EclipseResourceStorageProvider implements
/** Initializes the storage provider list from plugin extensions. */
private void setupLocationProviders() {
for (IConfigurationElement ce : ExtensionPointUtils
.getConfigurationElements(EXTENSION_POINT_NAME,
CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = ExtensionPointUtils.getBundle(ce);
for (IConfigurationElement ce : getConfigurationElements(
EXTENSION_POINT_NAME, CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = getBundle(ce);
try {
Class<?> handlerClass = ExtensionPointUtils.loadClass(
ce.getAttribute("provider"), bundle);
Class<?> handlerClass = loadClass(ce.getAttribute("provider"),
bundle);
IEclipseResourceStorageLocationProvider provider = (IEclipseResourceStorageLocationProvider) handlerClass
.getConstructor().newInstance();
storageProviderList.add(provider);
} catch (Exception ex) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
ex.getMessage(), ex);
error(ToolingKernelActivator.getDefault(), ex.getMessage(), ex);
}
}
}
......
......@@ -17,6 +17,9 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.storage.eclipse;
import static org.fortiss.tooling.kernel.utils.EMFResourceUtils.buildOptionsMap;
import static org.fortiss.tooling.kernel.utils.LoggingUtils.error;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
......@@ -44,8 +47,6 @@ import org.fortiss.tooling.kernel.ToolingKernelActivator;
import org.fortiss.tooling.kernel.extension.data.ITopLevelElement;
import org.fortiss.tooling.kernel.model.IIdLabeled;
import org.fortiss.tooling.kernel.service.IPersistencyService;
import org.fortiss.tooling.kernel.utils.EMFResourceUtils;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
/**
* The model context provides additional commands and hooks for a model.
......@@ -54,7 +55,7 @@ import org.fortiss.tooling.kernel.utils.LoggingUtils;
* @author hummel
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: BD4970391280C8C290235EB9DE2C742D
* @ConQAT.Rating YELLOW Hash: DC486D7885D3E9603B1672F7B269ABC1
*/
class ModelContext implements ITopLevelElement, CommandStackListener {
......@@ -92,7 +93,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
r = rset.createResource(URI.createPlatformResourceURI(file
.getFullPath().toString(), true));
r.load(EMFResourceUtils.buildOptionsMap());
r.load(buildOptionsMap());
transactionalCommandStack = new AutoUndoCommandStack(editingDomain);
transactionalCommandStack.addCommandStackListener(this);
......@@ -242,7 +243,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
// model can lead to partially written files which are unreadable and
// thus cause data loss.
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
r.save(bytes, EMFResourceUtils.buildOptionsMap());
r.save(bytes, buildOptionsMap());
monitor.worked(1);
setLastChangeWasIntended();
......@@ -306,7 +307,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
notifyListenersMethod.setAccessible(true);
notifyListenersMethod.invoke(commandStack);
} catch (Exception e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Notification after save failed!", e);
}
}
......@@ -363,7 +364,7 @@ class ModelContext implements ITopLevelElement, CommandStackListener {
getFile().delete(false, null);
return true;
} catch (CoreException e) {
LoggingUtils.error(ToolingKernelActivator.getDefault(),
error(ToolingKernelActivator.getDefault(),
"Error during deletion of model file "
+ getFile().getName());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment