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

Added EclipseResourceStorageProvider introspection with UI.

refs 2460
parent a4666025
No related branches found
No related tags found
No related merge requests found
......@@ -23,12 +23,14 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.items.ConnectionCompositorServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.items.ConstraintCheckerServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageProviderIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.items.PersistencyServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.items.PrototypeServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.items.TransformationServiceIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ConnectionCompositorServiceIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ConstraintCheckerServiceIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.ContextMenuServiceIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.EclipseResourceStorageProviderIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.PersistencyServiceIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.PrototypeServiceIntrospectionDetailsUIHandler;
import org.fortiss.tooling.kernel.ui.internal.introspection.details.handler.TransformationServiceIntrospectionDetailsUIHandler;
......@@ -59,6 +61,8 @@ public final class KISSDetailsUIRegistry {
new ConstraintCheckerServiceIntrospectionDetailsUIHandler());
registerHandler(ContextMenuServiceIntrospectionDetailsItem.class,
new ContextMenuServiceIntrospectionDetailsUIHandler());
registerHandler(EclipseResourceStorageProviderIntrospectionDetailsItem.class,
new EclipseResourceStorageProviderIntrospectionDetailsUIHandler());
registerHandler(PrototypeServiceIntrospectionDetailsItem.class,
new PrototypeServiceIntrospectionDetailsUIHandler());
registerHandler(PersistencyServiceIntrospectionDetailsItem.class,
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.internal.introspection.details.handler;
import org.conqat.ide.commons.ui.jface.TreeContentProviderBase;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TableLabelProviderBase;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.ui.dialogs.PatternFilter;
import org.fortiss.tooling.kernel.extension.IEclipseResourcePostLoadProvider;
import org.fortiss.tooling.kernel.extension.IEclipseResourceStorageLocationProvider;
import org.fortiss.tooling.kernel.extension.data.ModelStorageError;
import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageProviderIntrospectionDetailsItem;
/**
* Introspection UI handler for the {@link EclipseResourceStorageProviderIntrospectionDetailsItem}s.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public final class EclipseResourceStorageProviderIntrospectionDetailsUIHandler extends
IntrospectionDetailsUIHandlerBase {
/** {@inheritDoc} */
@Override
public Control createComposite(ScrolledComposite parent) {
return createFilteredTree(parent, "Type to search registered persistency providers:", null);
}
/** {@inheritDoc} */
@Override
protected void createTreeColumns(Tree tree) {
TreeColumn col0 = new TreeColumn(tree, SWT.LEFT);
col0.setText("Category / Provider / File");
col0.setWidth(450);
TreeColumn col1 = new TreeColumn(tree, SWT.LEFT);
col1.setText("Implementation Class / Path / Storage Error Message");
col1.setWidth(400);
}
/** String array of root categories. */
private final String[] ROOT_CATEGORY = new String[] {"Storage Provider", "Post-load Provider",
"Loaded Files", "Erroneous Files"};
/** {@inheritDoc} */
@Override
protected ITreeContentProvider createContentProvider() {
return new TreeContentProviderBase() {
@Override
public Object[] getChildren(Object parentElement) {
if(parentElement == getInputObject()) {
return ROOT_CATEGORY;
}
if(ROOT_CATEGORY[0].equals(parentElement)) {
return getInputObject().getStorageProviderList().toArray();
}
if(ROOT_CATEGORY[1].equals(parentElement)) {
return getInputObject().getPostLoadProviderList().toArray();
}
if(ROOT_CATEGORY[2].equals(parentElement)) {
return getInputObject().getLoadedFiles().toArray();
}
if(ROOT_CATEGORY[3].equals(parentElement)) {
return getInputObject().getErrorFiles().toArray();
}
return null;
}
};
}
/** {@inheritDoc} */
@Override
protected ITableLabelProvider createLabelProvider() {
return new TableLabelProviderBase() {
@Override
public String getColumnText(Object parentElement, int columnIndex) {
if(parentElement instanceof IEclipseResourceStorageLocationProvider ||
parentElement instanceof IEclipseResourcePostLoadProvider) {
return columnIndex == 0 ? parentElement.getClass().getSimpleName()
: parentElement.getClass().getName();
}
if(parentElement instanceof String) {
return columnIndex == 0 ? (String)parentElement : "";
}
if(parentElement instanceof IFile) {
IFile file = (IFile)parentElement;
return columnIndex == 0 ? file.getName() : file.getFullPath().toString();
}
if(parentElement instanceof ModelStorageError) {
ModelStorageError error = (ModelStorageError)parentElement;
return columnIndex == 0 ? "" : error.getMessage();
}
return "";
}
};
}
/** {@inheritDoc} */
@Override
protected PatternFilter createPatternFilter() {
return new TableViewerPatternFilter();
}
/** {@inheritDoc} */
@Override
protected EclipseResourceStorageProviderIntrospectionDetailsItem getInputObject() {
return (EclipseResourceStorageProviderIntrospectionDetailsItem)dataItem;
}
}
......@@ -46,7 +46,7 @@ public final class PrototypeServiceIntrospectionDetailsUIHandler extends
/** {@inheritDoc} */
@Override
public Control createComposite(ScrolledComposite parent) {
String heading = "Type to serach registered providers:";
String heading = "Type to search registered providers:";
String footer =
"Number of currently registered prototypes: " +
IPrototypeService.INSTANCE.getAllPrototypes().size() + " (" +
......
......@@ -17,6 +17,9 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.internal.storage.eclipse;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableSet;
import static org.eclipse.core.resources.IResourceDelta.ADDED;
import static org.eclipse.core.resources.IResourceDelta.CHANGED;
import static org.eclipse.core.resources.IResourceDelta.REMOVED;
......@@ -63,6 +66,7 @@ import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import org.fortiss.tooling.kernel.introspection.IIntrospectiveKernelService;
import org.fortiss.tooling.kernel.introspection.KernelIntrospectionSystemService;
import org.fortiss.tooling.kernel.introspection.items.EclipseResourceStorageProviderIntrospectionDetailsItem;
import org.fortiss.tooling.kernel.service.IEclipseResourceStorageService;
import org.fortiss.tooling.kernel.service.IMigrationService;
import org.fortiss.tooling.kernel.service.IPersistencyService;
......@@ -403,15 +407,15 @@ public class EclipseResourceStorageProvider implements IEclipseResourceStorageSe
/** {@inheritDoc} */
@Override
public Collection<IIntrospectionItem> getIntrospectionItems() {
// TODO continue HERE
return null;
return emptyList();
}
/** {@inheritDoc} */
@Override
public IIntrospectionDetailsItem getDetailsItem() {
// TODO continue HERE
return null;
return new EclipseResourceStorageProviderIntrospectionDetailsItem(
unmodifiableList(storageProviderList), unmodifiableList(postLoadProviderList),
unmodifiableSet(loadedContexts.keySet()), unmodifiableList(errorFiles));
}
/** {@inheritDoc} */
......
/*--------------------------------------------------------------------------+
$Id$
| |
| Copyright 2016 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.introspection.items;
import java.util.Collection;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.fortiss.tooling.kernel.extension.IEclipseResourcePostLoadProvider;
import org.fortiss.tooling.kernel.extension.IEclipseResourceStorageLocationProvider;
import org.fortiss.tooling.kernel.extension.data.ModelStorageError;
import org.fortiss.tooling.kernel.internal.storage.eclipse.EclipseResourceStorageProvider;
import org.fortiss.tooling.kernel.introspection.IIntrospectionDetailsItem;
/**
* {@link IIntrospectionDetailsItem} class for {@link EclipseResourceStorageProvider}.
*
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash:
*/
public final class EclipseResourceStorageProviderIntrospectionDetailsItem implements
IIntrospectionDetailsItem {
/** Stores the registered storage providers. */
private final List<IEclipseResourceStorageLocationProvider> storageProviderList;
/** Stores the registered post loading providers. */
private final List<IEclipseResourcePostLoadProvider> postLoadProviderList;
/** Cache of models loaded so far. */
private final Collection<IFile> loadedContexts;
/** List of failed model storage files. */
private final List<ModelStorageError> errorFiles;
/** Constructor. */
public EclipseResourceStorageProviderIntrospectionDetailsItem(
List<IEclipseResourceStorageLocationProvider> storageProviderList,
List<IEclipseResourcePostLoadProvider> postLoadProviderList,
Collection<IFile> loadedContexts, List<ModelStorageError> errorFiles) {
this.storageProviderList = storageProviderList;
this.postLoadProviderList = postLoadProviderList;
this.loadedContexts = loadedContexts;
this.errorFiles = errorFiles;
}
/** Returns the storage provider list. */
public List<IEclipseResourceStorageLocationProvider> getStorageProviderList() {
return storageProviderList;
}
/** Returns the post load provider list. */
public List<IEclipseResourcePostLoadProvider> getPostLoadProviderList() {
return postLoadProviderList;
}
/** Returns the loaded contexts. */
public Collection<IFile> getLoadedFiles() {
return loadedContexts;
}
/** Returns the error files. */
public List<ModelStorageError> getErrorFiles() {
return errorFiles;
}
}
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