diff options
250 files changed, 0 insertions, 24555 deletions
diff --git a/bundles/org.eclipse.e4.tools.compat/.classpath b/bundles/org.eclipse.e4.tools.compat/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.compat/.project b/bundles/org.eclipse.e4.tools.compat/.project deleted file mode 100644 index e5e9a152..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.compat</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4fe42718..00000000 --- a/bundles/org.eclipse.e4.tools.compat/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon May 31 09:52:05 CEST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF deleted file mode 100644 index 4225c506..00000000 --- a/bundles/org.eclipse.e4.tools.compat/META-INF/MANIFEST.MF +++ /dev/null @@ -1,19 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Compat -Bundle-SymbolicName: org.eclipse.e4.tools.compat;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.inject;bundle-version="1.0.0" -Service-Component: OSGI-INF/selectionproviderfunction.xml -Export-Package: org.eclipse.e4.tools.compat.parts -Bundle-ActivationPolicy: lazy diff --git a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml deleted file mode 100644 index 15b8531d..00000000 --- a/bundles/org.eclipse.e4.tools.compat/OSGI-INF/selectionproviderfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.compat.selectionprovider"> - <implementation class="org.eclipse.e4.tools.compat.internal.SelectionProviderContextFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.services.ISelectionProviderService"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.compat/build.properties b/bundles/org.eclipse.e4.tools.compat/build.properties deleted file mode 100644 index 4975ca25..00000000 --- a/bundles/org.eclipse.e4.tools.compat/build.properties +++ /dev/null @@ -1,6 +0,0 @@ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - OSGI-INF/selectionproviderfunction.xml -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.compat/plugin.xml b/bundles/org.eclipse.e4.tools.compat/plugin.xml deleted file mode 100644 index a8396863..00000000 --- a/bundles/org.eclipse.e4.tools.compat/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.services"> - <serviceFactory - factoryClass="org.eclipse.e4.tools.compat.internal.ContextServiceFactory"> - <service - serviceClass="org.eclipse.e4.core.contexts.IEclipseContext"></service> - </serviceFactory> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java deleted file mode 100644 index 4db5af43..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ContextServiceFactory.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.EclipseContextFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.log.ILoggerProvider; -import org.eclipse.e4.core.services.log.Logger; -import org.eclipse.e4.ui.css.swt.theme.IThemeEngine; -import org.eclipse.e4.ui.css.swt.theme.IThemeManager; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.ISelectionService; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.internal.services.IWorkbenchLocationService; -import org.eclipse.ui.services.AbstractServiceFactory; -import org.eclipse.ui.services.IServiceLocator; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.w3c.dom.css.CSSStyleDeclaration; - -@SuppressWarnings("restriction") -public class ContextServiceFactory extends AbstractServiceFactory { - - @Override - public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServiceLocator parentLocator, - IServiceLocator locator) { - if( ! IEclipseContext.class.equals(serviceInterface) ) { - return null; - } - - - IWorkbenchLocationService wls = (IWorkbenchLocationService) locator.getService(IWorkbenchLocationService.class); - final IWorkbenchWindow window = wls.getWorkbenchWindow(); - final IWorkbenchPartSite site = wls.getPartSite(); - -// System.err.println("The locator: " + locator); -// System.err.println(" Window: " + window); -// System.err.println(" Site: " + site); - - Object o = parentLocator.getService(serviceInterface); - - // This happens when we run in plain 3.x - // We need to create a parent service context - if( window == null && site == null ) { - Bundle bundle = FrameworkUtil.getBundle(ContextServiceFactory.class); - BundleContext bundleContext = bundle.getBundleContext(); - IEclipseContext serviceContext = EclipseContextFactory.getServiceContext(bundleContext); - - final IEclipseContext appContext = serviceContext.createChild("WorkbenchContext"); //$NON-NLS-1$ - appContext.set(Logger.class, new WorkbenchLogger()); - IContributionFactory contributionFactory = ContextInjectionFactory.make(ReflectionContributionFactory.class, appContext); - appContext.set(IContributionFactory.class.getName(),contributionFactory); - - IThemeManager manager = serviceContext.get(IThemeManager.class); - final IThemeEngine engine = manager.getEngineForDisplay(Display.getCurrent()); - appContext.set(IThemeEngine.class, engine); - - appContext.set(IStylingEngine.class, new IStylingEngine() { - - public void setClassname(Object widget, String classname) { - ((Widget) widget).setData( - "org.eclipse.e4.ui.css.CssClassName", classname); //$NON-NLS-1$ - engine.applyStyles((Widget) widget, true); - } - - public void setId(Object widget, String id) { - ((Widget) widget).setData("org.eclipse.e4.ui.css.id", id); //$NON-NLS-1$ - engine.applyStyles((Widget) widget, true); - } - - public void style(Object widget) { - engine.applyStyles((Widget) widget, true); - } - - public CSSStyleDeclaration getStyle(Object widget) { - return engine.getStyle((Widget) widget); - } - }); - - if( appContext.get(ILoggerProvider.class) == null ) { - appContext.set(ILoggerProvider.class, ContextInjectionFactory.make(DefaultLoggerProvider.class, appContext)); - } - - return appContext; - } else if( o != null && site == null ) { - final IEclipseContext windowContext = ((IEclipseContext)o).createChild("WindowContext("+window+")"); - windowContext.set(ISelectionService.class, window.getSelectionService()); - - windowContext.declareModifiable(IServiceConstants.ACTIVE_SELECTION); - window.getSelectionService().addSelectionListener(new ISelectionListener() { - - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if( ! selection.isEmpty() ) { - if( selection instanceof IStructuredSelection ) { - IStructuredSelection s = (IStructuredSelection) selection; - if( s.size() == 1 ) { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.getFirstElement()); - } else { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, s.toList()); - } - } else { - windowContext.set(IServiceConstants.ACTIVE_SELECTION, selection); - } - } - } - }); - return windowContext; - } - - return o; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java deleted file mode 100644 index b3f922b0..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/DefaultLoggerProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import javax.inject.Inject; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.services.log.ILoggerProvider; -import org.eclipse.e4.core.services.log.Logger; -import org.osgi.framework.FrameworkUtil; - -public class DefaultLoggerProvider implements ILoggerProvider { - @Inject - private IEclipseContext context; - - public Logger getClassLogger(Class<?> clazz) { - IEclipseContext childContext = context.createChild(); - childContext.set("logger.bundlename", FrameworkUtil.getBundle(clazz).getSymbolicName()); //$NON-NLS-1$ - return (Logger) ContextInjectionFactory.make(WorkbenchLogger.class, childContext); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java deleted file mode 100644 index 58484ff4..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/PartHelper.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import java.lang.reflect.Method; - -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.WorkbenchPart; - -public class PartHelper { - public static IEclipseContext createPartContext(WorkbenchPart part) throws PartInitException { - IWorkbenchPartSite site = part.getSite(); - IEclipseContext parentContext = (IEclipseContext) site.getService(IEclipseContext.class); - - // Check if running in 4.x - if( parentContext.get("org.eclipse.e4.workbench.ui.IPresentationEngine") != null ) { - // Hack to get the MPart-Context - try { - Class<?> clazz = Util.getBundle("org.eclipse.e4.ui.model.workbench").loadClass("org.eclipse.e4.ui.model.application.ui.basic.MPart"); - Object instance = site.getService(clazz); - Method m = clazz.getMethod("getContext", new Class[0]); - return (IEclipseContext) m.invoke(instance); - } catch (Exception e) { - throw new PartInitException("Could not create context",e); - } - } else { - return parentContext.createChild("EditPart('"+part.getPartName()+"')"); //$NON-NLS-1$ - } - - } - - public static <C> C creatComponent(Composite parent, IEclipseContext context, Class<C> clazz, WorkbenchPart part) { - ISelectionProvider s = new SelectionProviderImpl(); - context.set(ISelectionProvider.class, s); - part.getSite().setSelectionProvider(s); - - IStylingEngine styleEngine = context.get(IStylingEngine.class); - Composite comp = new Composite(parent, SWT.NONE); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - - //FIXME This should be read from the CSS - FillLayout layout = new FillLayout(); - layout.marginWidth = 10; - layout.marginHeight = 10; - comp.setLayout(layout); - - context.set(Composite.class.getName(), comp); - C component = ContextInjectionFactory.make(clazz, context); - - styleEngine.setClassname(comp, part.getClass().getSimpleName()); - - return component; - } - - static class SelectionProviderImpl implements ISelectionProvider { - private ISelection currentSelection = StructuredSelection.EMPTY; - - private ListenerList listeners = new ListenerList(); - - public void setSelection(ISelection selection) { - currentSelection = selection; - SelectionChangedEvent evt = new SelectionChangedEvent(this, selection); - - for( Object l : listeners.getListeners() ) { - ((ISelectionChangedListener)l).selectionChanged(evt); - } - } - - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - listeners.remove(listener); - } - - public ISelection getSelection() { - return currentSelection; - } - - public void addSelectionChangedListener(ISelectionChangedListener listener) { - listeners.add(listener); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java deleted file mode 100644 index 5b61577c..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/ReflectionContributionFactory.java +++ /dev/null @@ -1,186 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import java.util.HashMap; -import java.util.Map; - -import javax.inject.Inject; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.InjectionException; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.core.services.contributions.IContributionFactorySpi; -import org.eclipse.e4.core.services.log.Logger; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * Create the contribution factory. - */ -@SuppressWarnings("restriction") -public class ReflectionContributionFactory implements IContributionFactory { - - private IExtensionRegistry registry; - private Map<String, Object> languages; - - @Inject - private PackageAdmin packageAdmin; - - @Inject - private Logger logger; - - /** - * Create a reflection factory. - * - * @param registry - * to read languages. - */ - @Inject - public ReflectionContributionFactory(IExtensionRegistry registry) { - this.registry = registry; - processLanguages(); - } - - public Object create(String uriString, IEclipseContext context, IEclipseContext staticContext) { - return doCreate(uriString, context, staticContext); - } - - public Object create(String uriString, IEclipseContext context) { - return doCreate(uriString, context, null); - } - - private Object doCreate(String uriString, IEclipseContext context, IEclipseContext staticContext) { - if (uriString == null) { - return null; - } - URI uri = URI.createURI(uriString); - Bundle bundle = getBundle(uri); - Object contribution; - if (bundle != null) { - contribution = createFromBundle(bundle, context, staticContext, uri); - } else { - contribution = null; - logger.error("Unable to retrive the bundle from the URI: " //$NON-NLS-1$ - + uriString); - } - return contribution; - } - - protected Object createFromBundle(Bundle bundle, IEclipseContext context, - IEclipseContext staticContext, URI uri) { - Object contribution; - if (uri.segmentCount() > 3) { - String prefix = uri.segment(2); - IContributionFactorySpi factory = (IContributionFactorySpi) languages.get(prefix); - StringBuffer resource = new StringBuffer(uri.segment(3)); - for (int i = 4; i < uri.segmentCount(); i++) { - resource.append('/'); - resource.append(uri.segment(i)); - } - contribution = factory.create(bundle, resource.toString(), context); - } else { - String clazz = uri.segment(2); - try { - Class<?> targetClass = bundle.loadClass(clazz); - if (staticContext == null) - contribution = ContextInjectionFactory.make(targetClass, context); - else - contribution = ContextInjectionFactory - .make(targetClass, context, staticContext); - - if (contribution == null) { - String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(message); - } - } catch (ClassNotFoundException e) { - contribution = null; - String message = "Unable to load class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(e,message); - } catch (InjectionException e) { - contribution = null; - String message = "Unable to create class '" + clazz + "' from bundle '" //$NON-NLS-1$ //$NON-NLS-2$ - + bundle.getBundleId() + "'"; //$NON-NLS-1$ - logger.error(e, message); - } - } - return contribution; - } - - protected void processLanguages() { - languages = new HashMap<String, Object>(); - String extId = "org.eclipse.e4.languages"; //$NON-NLS-1$ - IConfigurationElement[] languageElements = registry.getConfigurationElementsFor(extId); - for (int i = 0; i < languageElements.length; i++) { - IConfigurationElement languageElement = languageElements[i]; - try { - languages.put(languageElement.getAttribute("name"), //$NON-NLS-1$ - languageElement.createExecutableExtension("contributionFactory")); //$NON-NLS-1$ - } catch (InvalidRegistryObjectException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - - protected Bundle getBundle(URI platformURI) { - return getBundleForName(platformURI.segments[1]); - } - - public Bundle getBundle(String uriString) { - return getBundle(new URI(uriString)); - } - - public Bundle getBundleForName(String bundlename) { - if( packageAdmin == null ) { - Bundle bundle = FrameworkUtil.getBundle(getClass()); - BundleContext context = bundle.getBundleContext(); - ServiceReference reference = context.getServiceReference(PackageAdmin.class.getName()); - packageAdmin = (PackageAdmin) context.getService(reference); - } - - Bundle[] bundles = packageAdmin.getBundles(bundlename, null); - if (bundles == null) - return null; - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } - - static class URI { - String[] segments; - String uri; - - URI(String uriString) { - segments = uriString.substring(uriString.indexOf('/')+1).split("/"); - } - - public String segment(int i) { - return segments[i]; - } - - public int segmentCount() { - return segments.length; - } - - static URI createURI(String uriString) { - return new URI(uriString); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java deleted file mode 100644 index 901627cd..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/SelectionProviderContextFunction.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.internal; - -import java.util.List; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.ISelectionProviderService; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; - - -public class SelectionProviderContextFunction extends ContextFunction { - - @Override - public Object compute(final IEclipseContext context) { - return new ISelectionProviderService() { - public void setSelection(Object selection) { - ISelectionProvider pv = context.get(ISelectionProvider.class); - - if( selection instanceof List<?> ) { - pv.setSelection(new StructuredSelection((List<?>)selection)); - } else { - pv.setSelection(new StructuredSelection(selection)); - } - - } - }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java deleted file mode 100644 index 567fcc2b..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/Util.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -public class Util { - public static Bundle getBundle(String bundleName) { - Bundle bundle = FrameworkUtil.getBundle(Util.class); - BundleContext ctx = bundle.getBundleContext(); - ServiceReference ref = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName()); - PackageAdmin bundleAdmin = (PackageAdmin) ctx.getService(ref); - Bundle[] bundles = bundleAdmin.getBundles(bundleName, null); - if (bundles == null) - return null; - // Return the first bundle that is not installed or uninstalled - for (int i = 0; i < bundles.length; i++) { - if ((bundles[i].getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) { - return bundles[i]; - } - } - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java deleted file mode 100644 index d5e64d8a..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/internal/WorkbenchLogger.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.eclipse.e4.tools.compat.internal; - -import java.util.ArrayList; -import javax.inject.Inject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.core.services.log.Logger; -import org.eclipse.osgi.framework.log.FrameworkLog; -import org.eclipse.osgi.framework.log.FrameworkLogEntry; -import org.eclipse.osgi.service.debug.DebugOptions; -import org.eclipse.osgi.service.debug.DebugTrace; -import org.osgi.framework.Bundle; -import org.osgi.framework.FrameworkUtil; - -/** - * The workbench implementation of the logger service. - */ -public final class WorkbenchLogger extends Logger { - protected DebugTrace trace; - protected FrameworkLog log; - private Bundle bundle = FrameworkUtil.getBundle(WorkbenchLogger.class); - - /** - * Creates a new workbench logger - */ - public WorkbenchLogger() { - super(); - } - - public void debug(Throwable t) { - debug(t, null); - } - - public void debug(Throwable t, String message) { - trace(t, message); - } - - public void error(Throwable t, String message) { - log(new Status(IStatus.ERROR, bundle.getSymbolicName(), - message, t)); - } - - /** - * Copied from PlatformLogWriter in core runtime. - */ - private static FrameworkLogEntry getLog(IStatus status) { - Throwable t = status.getException(); - ArrayList childlist = new ArrayList(); - - int stackCode = t instanceof CoreException ? 1 : 0; - // ensure a substatus inside a CoreException is properly logged - if (stackCode == 1) { - IStatus coreStatus = ((CoreException) t).getStatus(); - if (coreStatus != null) { - childlist.add(getLog(coreStatus)); - } - } - - if (status.isMultiStatus()) { - IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - childlist.add(getLog(children[i])); - } - } - - FrameworkLogEntry[] children = (FrameworkLogEntry[]) (childlist.size() == 0 ? null - : childlist.toArray(new FrameworkLogEntry[childlist.size()])); - - return new FrameworkLogEntry(status.getPlugin(), status.getSeverity(), status.getCode(), - status.getMessage(), stackCode, t, children); - } - - public void info(Throwable t, String message) { - log(new Status(IStatus.INFO, bundle.getSymbolicName(), message, - t)); - } - - public boolean isDebugEnabled() { - return false; - } - - public boolean isErrorEnabled() { - return true; - } - - public boolean isInfoEnabled() { - return true; - } - - public boolean isTraceEnabled() { - return false; - } - - public boolean isWarnEnabled() { - return true; - } - - private void log(IStatus status) { - if (log != null) { - log.log(getLog(status)); - } else { - System.out.println(status.getMessage()); - if (status.getException() != null) - status.getException().printStackTrace(); - } - } - - /** - * Sets the debug options service for this logger. - * - * @param options - * The debug options to be used by this logger - */ - @Inject - public void setDebugOptions(DebugOptions options) { - if (options != null) { - this.trace = options.newDebugTrace(bundle.getSymbolicName(), WorkbenchLogger.class); - } - } - - /** - * @param log - */ - @Inject - public void setFrameworkLog(FrameworkLog log) { - this.log = log; - } - - public void trace(Throwable t, String message) { - if (trace != null) { - trace.trace(null, message, t); - } else { - System.out.println(message); - t.printStackTrace(); - } - } - - public void warn(Throwable t, String message) { - log(new Status(IStatus.WARNING, bundle.getSymbolicName(), - message, t)); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java deleted file mode 100644 index dc711b9e..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIEditorPart.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.compat.internal.PartHelper; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; - -public abstract class DIEditorPart<C> extends EditorPart implements IDirtyProviderService { - private IEclipseContext context; - private C component; - private Class<C> clazz; - private boolean dirtyState; - - public DIEditorPart(Class<C> clazz) { - this.clazz = clazz; - } - - @Override - public void doSave(IProgressMonitor monitor) { - IEclipseContext saveContext = context.createChild(); - ContextInjectionFactory.invoke(component, Persist.class, saveContext); - saveContext.dispose(); - } - - @Override - public void doSaveAs() { - - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - setSite(site); - setInput(input); - - context = PartHelper.createPartContext(this); - context.declareModifiable(IEditorInput.class); - context.declareModifiable(IEditorPart.class); - context.declareModifiable(IDirtyProviderService.class); - - context.set(IEditorPart.class,this); - context.set(IDirtyProviderService.class,this); - context.set(IEditorInput.class, input); - } - - - @Override - public void createPartControl(Composite parent) { - component = PartHelper.creatComponent(parent, context, clazz, this); - } - - public C getComponent() { - return component; - } - - public void setDirtyState(boolean dirtyState) { - if( dirtyState != this.dirtyState ) { - this.dirtyState = dirtyState; - firePropertyChange(PROP_DIRTY); - } - } - - @Override - public boolean isDirty() { - return dirtyState; - } - - @Override - public void setFocus() { - ContextInjectionFactory.invoke(component, Focus.class, context); - } - - @Override - public void dispose() { - context.dispose(); - context = null; - super.dispose(); - } -} diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java deleted file mode 100644 index b9cb94eb..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DISaveableViewPart.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.ui.ISaveablePart2; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; - -public abstract class DISaveableViewPart<C> extends DIViewPart<C> implements ISaveablePart2, IDirtyProviderService { - private boolean dirtyState; - - public DISaveableViewPart(Class<C> clazz) { - super(clazz); - } - - public void doSave(IProgressMonitor monitor) { - IEclipseContext saveContext = getContext().createChild(); - ContextInjectionFactory.invoke(getComponent(), Persist.class, saveContext); - saveContext.dispose(); - } - - public void doSaveAs() { - - } - - public boolean isSaveAsAllowed() { - return false; - } - - public void setDirtyState(boolean dirtyState) { - if( dirtyState != this.dirtyState ) { - this.dirtyState = dirtyState; - firePropertyChange(PROP_DIRTY); - } - } - - public boolean isDirty() { - return dirtyState; - } - - public void init(IViewSite site) throws PartInitException { - super.init(site); - - getContext().declareModifiable(IDirtyProviderService.class); - getContext().set(IDirtyProviderService.class, this); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java b/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java deleted file mode 100644 index 46a29f69..00000000 --- a/bundles/org.eclipse.e4.tools.compat/src/org/eclipse/e4/tools/compat/parts/DIViewPart.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.compat.parts; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.InjectionException; -import org.eclipse.e4.tools.compat.internal.PartHelper; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.ViewPart; - -public abstract class DIViewPart<C> extends ViewPart { - private IEclipseContext context; - private Class<C> clazz; - private C component; - - public DIViewPart(Class<C> clazz) { - this.clazz = clazz; - } - - @Override - public void init(IViewSite site) throws PartInitException { - super.init(site); - context = PartHelper.createPartContext(this); - - context.declareModifiable(IViewPart.class); - - context.set(IViewPart.class, this); - } - - @Override - public void createPartControl(Composite parent) { - component = PartHelper.creatComponent(parent, context, clazz, this); - } - - protected IEclipseContext getContext() { - return context; - } - - public C getComponent() { - return component; - } - - @Override - public void setFocus() { - try { - ContextInjectionFactory.invoke(component, Focus.class, context); - } catch (InjectionException e) { - // TODO: handle exception - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.context/.classpath b/bundles/org.eclipse.e4.tools.context/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.context/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.context/.project b/bundles/org.eclipse.e4.tools.context/.project deleted file mode 100644 index 079583bd..00000000 --- a/bundles/org.eclipse.e4.tools.context/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.context</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c987469a..00000000 --- a/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Wed Mar 24 16:01:57 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 041d6be3..00000000 --- a/bundles/org.eclipse.e4.tools.context/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Wed Mar 24 16:13:19 EDT 2010 -eclipse.preferences.version=1 -pluginProject.extensions=true -resolve.requirebundle=false diff --git a/bundles/org.eclipse.e4.tools.context/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.context/META-INF/MANIFEST.MF deleted file mode 100644 index 39ffa787..00000000 --- a/bundles/org.eclipse.e4.tools.context/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Tools -Bundle-SymbolicName: org.eclipse.e4.tools.context;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0" -Export-Package: org.eclipse.e4.tools.handlers diff --git a/bundles/org.eclipse.e4.tools.context/build.properties b/bundles/org.eclipse.e4.tools.context/build.properties deleted file mode 100644 index e9863e28..00000000 --- a/bundles/org.eclipse.e4.tools.context/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml diff --git a/bundles/org.eclipse.e4.tools.context/plugin.xml b/bundles/org.eclipse.e4.tools.context/plugin.xml deleted file mode 100644 index f68f7c7a..00000000 --- a/bundles/org.eclipse.e4.tools.context/plugin.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.commands"> - <command - categoryId="org.eclipse.e4.tools.category1" - defaultHandler="org.eclipse.e4.tools.handlers.GenerateSnapshotHandler" - id="org.eclipse.e4.tools.globalSnapshot" - name="Global Snapshot"> - </command> - <command - categoryId="org.eclipse.e4.tools.category1" - defaultHandler="org.eclipse.e4.tools.handlers.DiffSnapshotHandler" - id="org.eclipse.e4.tools.globalDiff" - name="Global Diff"> - </command> - <category - description="e4 tools" - id="org.eclipse.e4.tools.category1" - name="e4 tools"> - </category> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - allPopups="false" - locationURI="menu:org.eclipse.ui.main.menu?after=additions"> - <menu - id="org.eclipse.e4.tools.menu" - label="e4 tools"> - <command - commandId="org.eclipse.e4.tools.globalSnapshot" - mnemonic="S" - style="push"> - </command> - <command - commandId="org.eclipse.e4.tools.globalDiff" - mnemonic="D" - style="push"> - </command> - </menu> - </menuContribution> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/DiffSnapshotHandler.java b/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/DiffSnapshotHandler.java deleted file mode 100644 index ca1c9117..00000000 --- a/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/DiffSnapshotHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.handlers; - -import org.eclipse.core.commands.*; -import org.eclipse.e4.core.internal.contexts.EclipseContext; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Generates a diff of the main application context, showing changes since the - * last snapshot. - */ -public class DiffSnapshotHandler extends AbstractHandler { - - /* (non-Javadoc) - * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - MApplication app = (MApplication) HandlerUtil.getVariableChecked(event, - MApplication.class.getName()); - ((EclipseContext) app.getContext()).debugDiff(); - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/GenerateSnapshotHandler.java b/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/GenerateSnapshotHandler.java deleted file mode 100644 index 3b212b6d..00000000 --- a/bundles/org.eclipse.e4.tools.context/src/org/eclipse/e4/tools/handlers/GenerateSnapshotHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.handlers; - -import org.eclipse.core.commands.*; -import org.eclipse.e4.core.internal.contexts.EclipseContext; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.ui.handlers.HandlerUtil; - -/** - * Generates a snapshot of the current main application context state - */ -public class GenerateSnapshotHandler extends AbstractHandler { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. - * ExecutionEvent) - */ - public Object execute(ExecutionEvent event) throws ExecutionException { - MApplication app = (MApplication) HandlerUtil.getVariableChecked(event, - MApplication.class.getName()); - ((EclipseContext) app.getContext()).debugSnap(); - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor/.classpath b/bundles/org.eclipse.e4.tools.emf.editor/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/.project b/bundles/org.eclipse.e4.tools.emf.editor/.project deleted file mode 100644 index 624efe93..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.editor</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.editor/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index da2d41a3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Mar 07 16:24:33 CET 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.emf.editor/Application.e4xmi b/bundles/org.eclipse.e4.tools.emf.editor/Application.e4xmi deleted file mode 100644 index 9bb548c7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/Application.e4xmi +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmi:id="_oq6MwEY6Ed-3Rue18XuTew" elementId="org.eclipse.e4.ide.application"> - <children xsi:type="basic:TrimmedWindow" xmi:id="_Z-NzMUjJEd-FKq59UN1_HA" elementId="_Z-NzMUjJEd-FKq59UN1_HA" width="800" height="600"> - <children xsi:type="basic:PartStack" xmi:id="_gkgxwEjJEd-FKq59UN1_HA" elementId="org.eclipse.e4.tools.emf.editor.mainwindow.editorstack"> - <tags>newtablook</tags> - </children> - <mainMenu xmi:id="_LqyFoEjQEd-XR9_8rlW1bQ" elementId="e4.modeleditor.menu.file"> - <children xsi:type="menu:Menu" xmi:id="_cURncEjQEd-XR9_8rlW1bQ" elementId="e4.modeleditor.menu.file" label="File"> - <children xsi:type="menu:Menu" xmi:id="_mRNKoEjQEd-XR9_8rlW1bQ" elementId="_mRNKoEjQEd-XR9_8rlW1bQ" label="New"> - <children xsi:type="menu:HandledMenuItem" xmi:id="_pdLXYEjQEd-XR9_8rlW1bQ" elementId="_pdLXYEjQEd-XR9_8rlW1bQ" label="Application Model" command="_OI-FgEZCEd-3Rue18XuTew"/> - <children xsi:type="menu:HandledMenuItem" xmi:id="_z0xdUEjQEd-XR9_8rlW1bQ" elementId="_z0xdUEjQEd-XR9_8rlW1bQ" label="Model Contribution" command="_OcpPcEZCEd-3Rue18XuTew"/> - </children> - <children xsi:type="menu:HandledMenuItem" xmi:id="_5agWwEjQEd-XR9_8rlW1bQ" elementId="_5agWwEjQEd-XR9_8rlW1bQ" label="Open XMI ..." iconURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/folder_page.png" command="_Hx2ycEZCEd-3Rue18XuTew"/> - <children xsi:type="menu:HandledMenuItem" xmi:id="_ATY6IEjREd-XR9_8rlW1bQ" elementId="_ATY6IEjREd-XR9_8rlW1bQ" label="Save" command="_NyiigEZCEd-3Rue18XuTew"/> - </children> - </mainMenu> - <trimBars xmi:id="_5UAKUUjJEd-Y_4Sy4ZiGUQ" elementId="_5UAKUUjJEd-Y_4Sy4ZiGUQ"> - <children xsi:type="menu:ToolBar" xmi:id="_8DUQQEjJEd-Y_4Sy4ZiGUQ" elementId="_8DUQQEjJEd-Y_4Sy4ZiGUQ"> - <children xsi:type="menu:HandledToolItem" xmi:id="_GTv-QEjKEd-Y_4Sy4ZiGUQ" elementId="org.eclipse.e4.tools.emf.editor.mainwindow.trims.top.toolbars.main.items.openxmi" iconURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/folder_page.png" tooltip="Open XMI File" command="_Hx2ycEZCEd-3Rue18XuTew"/> - <children xsi:type="menu:HandledToolItem" xmi:id="_G1D7kEjKEd-Y_4Sy4ZiGUQ" elementId="org.eclipse.e4.tools.emf.editor.mainwindow.trims.top.toolbars.main.items.savexmi" iconURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/disk.png" tooltip="Save XMI" command="_NyiigEZCEd-3Rue18XuTew"/> - </children> - </trimBars> - </children> - <handlers xmi:id="_Jp-AEEZBEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.handlers.openxmi" contributionURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/org.eclipse.e4.tools.emf.editor.OpenModelFileHandler" command="_Hx2ycEZCEd-3Rue18XuTew"/> - <handlers xmi:id="_OTM1AEZBEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.handlers.savexmi" contributionURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/org.eclipse.e4.tools.emf.editor.SaveModelFileHandler" command="_NyiigEZCEd-3Rue18XuTew"/> - <handlers xmi:id="_Owa8gEZBEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.handlers.newappmodel" contributionURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/org.eclipse.e4.tools.emf.editor.NewApplicationModelHandler" command="_OI-FgEZCEd-3Rue18XuTew"/> - <handlers xmi:id="_PhoXAEZBEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.handlers.newcontribmodel" contributionURI="platform:/plugin/org.eclipse.e4.tools.emf.editor/org.eclipse.e4.tools.emf.editor.NewModelContributionHandler" command="_OcpPcEZCEd-3Rue18XuTew"/> - <bindingTables xmi:id="_a8i7IEZBEd-3Rue18XuTew" elementId="org.eclipse.ui.bindingtables.dialogAndWindow" bindingContextId="org.eclipse.ui.contexts.dialogAndWindow"> - <bindings xmi:id="_pTpjkEZBEd-3Rue18XuTew" keySequence="M1+S" elementId="_pTpjkEZBEd-3Rue18XuTew" command="_NyiigEZCEd-3Rue18XuTew"/> - </bindingTables> - <rootContext xmi:id="_uvPCgEZBEd-3Rue18XuTew" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows" description=""> - <children xmi:id="_1GFP0EZBEd-3Rue18XuTew" elementId="org.eclipse.ui.contexts.window" name="In Windows" description=""/> - <children xmi:id="_9_03sEZBEd-3Rue18XuTew" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs" description=""/> - </rootContext> - <bindingContexts>org.eclipse.ui.contexts.dialogAndWindow</bindingContexts> - <commands xmi:id="_Hx2ycEZCEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.commands.openxmi" commandName="e4editor.openxmi"/> - <commands xmi:id="_NyiigEZCEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.commands.savexmi" commandName="e4editor.savexmi"/> - <commands xmi:id="_OI-FgEZCEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.commands.newappmodel" commandName="e4editor.newappmodel"/> - <commands xmi:id="_OcpPcEZCEd-3Rue18XuTew" elementId="org.eclipse.e4.tools.emf.editor.commands.newcontribmodel" commandName="e4editor.newcontribmodel"/> -</application:Application> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor/META-INF/MANIFEST.MF deleted file mode 100644 index 83a17d18..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/META-INF/MANIFEST.MF +++ /dev/null @@ -1,23 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Editor -Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor; singleton:=true -Bundle-Version: 0.9.0.qualifier -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.e4.ui.workbench.swt;bundle-version="0.9.1", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.swt;bundle-version="3.6.0", - javax.inject;bundle-version="1.0.0", - org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.core.databinding.observable;bundle-version="1.3.0", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0" -Bundle-ActivationPolicy: lazy -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: org.eclipse.e4.core.contexts, - org.eclipse.e4.core.di.annotations -Service-Component: OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/selectionproviderfunction.xml diff --git a/bundles/org.eclipse.e4.tools.emf.editor/ModelEditor.product b/bundles/org.eclipse.e4.tools.emf.editor/ModelEditor.product deleted file mode 100644 index 1d6d2f00..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/ModelEditor.product +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?pde version="3.5"?> - -<product name="ModelEditor" id="org.eclipse.e4.tools.emf.editor.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" useFeatures="false" includeLaunchers="true"> - - <configIni use="default"> - </configIni> - - <launcherArgs> - <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgsMac> - </launcherArgs> - - <plugins> - <plugin id="com.ibm.icu"/> - <plugin id="javax.inject"/> - <plugin id="org.apache.batik.css"/> - <plugin id="org.apache.batik.util"/> - <plugin id="org.apache.batik.util.gui"/> - <plugin id="org.apache.commons.beanutils"/> - <plugin id="org.apache.commons.logging"/> - <plugin id="org.eclipse.core.commands"/> - <plugin id="org.eclipse.core.contenttype"/> - <plugin id="org.eclipse.core.databinding"/> - <plugin id="org.eclipse.core.databinding.observable"/> - <plugin id="org.eclipse.core.databinding.property"/> - <plugin id="org.eclipse.core.expressions"/> - <plugin id="org.eclipse.core.filesystem"/> - <plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/> - <plugin id="org.eclipse.core.jobs"/> - <plugin id="org.eclipse.core.resources"/> - <plugin id="org.eclipse.core.runtime"/> - <plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/> - <plugin id="org.eclipse.e4.core.commands"/> - <plugin id="org.eclipse.e4.core.services"/> - <plugin id="org.eclipse.e4.core.services.annotations" fragment="true"/> - <plugin id="org.eclipse.e4.tools.emf.editor"/> - <plugin id="org.eclipse.e4.tools.emf.ui"/> - <plugin id="org.eclipse.e4.ui.bindings"/> - <plugin id="org.eclipse.e4.ui.css.core"/> - <plugin id="org.eclipse.e4.ui.css.nebula"/> - <plugin id="org.eclipse.e4.ui.css.swt"/> - <plugin id="org.eclipse.e4.ui.model.workbench"/> - <plugin id="org.eclipse.e4.ui.model.workbench.edit"/> - <plugin id="org.eclipse.e4.ui.services"/> - <plugin id="org.eclipse.e4.ui.workbench"/> - <plugin id="org.eclipse.e4.ui.workbench.renderers.swt"/> - <plugin id="org.eclipse.e4.ui.workbench.swt"/> - <plugin id="org.eclipse.e4.ui.workbench3"/> - <plugin id="org.eclipse.emf.common"/> - <plugin id="org.eclipse.emf.databinding"/> - <plugin id="org.eclipse.emf.databinding.edit"/> - <plugin id="org.eclipse.emf.ecore"/> - <plugin id="org.eclipse.emf.ecore.change"/> - <plugin id="org.eclipse.emf.ecore.xmi"/> - <plugin id="org.eclipse.emf.edit"/> - <plugin id="org.eclipse.equinox.app"/> - <plugin id="org.eclipse.equinox.common"/> - <plugin id="org.eclipse.equinox.concurrent"/> - <plugin id="org.eclipse.equinox.ds"/> - <plugin id="org.eclipse.equinox.event"/> - <plugin id="org.eclipse.equinox.preferences"/> - <plugin id="org.eclipse.equinox.registry"/> - <plugin id="org.eclipse.equinox.util"/> - <plugin id="org.eclipse.jface"/> - <plugin id="org.eclipse.jface.databinding"/> - <plugin id="org.eclipse.nebula.widgets.gallery"/> - <plugin id="org.eclipse.osgi"/> - <plugin id="org.eclipse.osgi.services"/> - <plugin id="org.eclipse.swt"/> - <plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/> - <plugin id="org.eclipse.swt.gtk.linux.x86" fragment="true"/> - <plugin id="org.w3c.css.sac"/> - <plugin id="org.w3c.dom.smil"/> - <plugin id="org.w3c.dom.svg"/> - </plugins> - - -</product> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/selectionproviderfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/selectionproviderfunction.xml deleted file mode 100644 index c5204caa..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/selectionproviderfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor.selectionprovider"> - <implementation class="org.eclipse.e4.tools.emf.editor.SelectionProviderContextFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/xmiresourcecontextfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/xmiresourcecontextfunction.xml deleted file mode 100644 index 2c7c2e29..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/OSGI-INF/xmiresourcecontextfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor.xmiresource"> - <implementation class="org.eclipse.e4.tools.emf.editor.XMIResourceFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.common.IModelResource"/> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/build.properties b/bundles/org.eclipse.e4.tools.emf.editor/build.properties deleted file mode 100644 index 51b87b7d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - css/,\ - icons/,\ - Application.e4xmi,\ - OSGI-INF/xmiresourcecontextfunction.xml,\ - OSGI-INF/selectionproviderfunction.xml -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor/css/default.css b/bundles/org.eclipse.e4.tools.emf.editor/css/default.css deleted file mode 100644 index 192ddf5e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/css/default.css +++ /dev/null @@ -1,8 +0,0 @@ -CTabFolder { - tab-renderer: url('platform:/plugin/org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.workbench.ui.renderers.swt.CTabRendering'); - -} - -Shell { - background-color: #ffffff; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor/css/e4_default.css b/bundles/org.eclipse.e4.tools.emf.editor/css/e4_default.css deleted file mode 100644 index b78bf7f9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/css/e4_default.css +++ /dev/null @@ -1,21 +0,0 @@ - -.MWindow { - background-color: #EEF2F7 #DEEBF3 100%; -} - -.MPartStack { - tab-renderer: url('platform:/plugin/org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.workbench.ui.renderers.swt.CTabRendering'); - unselected-tabs-color: #FFFFFF #FFFFFF #FFFFFF 100% 100%; - outer-keyline-color: #FFFFFF; - inner-keyline-color: #FFFFFF; -} - -.MTrimBar { - background-image: url(./winXPBlue.PNG); -} - -.MPartStack.active { - unselected-tabs-color: #CEDEF4 #D2E2F9 #FFFFFF 100% 100%; - outer-keyline-color: #C3D0E9; - inner-keyline-color: #FFFFFF; -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png b/bundles/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/disk.png b/bundles/org.eclipse.e4.tools.emf.editor/icons/full/disk.png Binary files differdeleted file mode 100644 index 99d532e8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/disk.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/folder_page.png b/bundles/org.eclipse.e4.tools.emf.editor/icons/full/folder_page.png Binary files differdeleted file mode 100644 index 1ef6e114..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/icons/full/folder_page.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor/images/winXPBlue.PNG b/bundles/org.eclipse.e4.tools.emf.editor/images/winXPBlue.PNG Binary files differdeleted file mode 100644 index 57e94e5d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/images/winXPBlue.PNG +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor/images/winXPOlive.PNG b/bundles/org.eclipse.e4.tools.emf.editor/images/winXPOlive.PNG Binary files differdeleted file mode 100644 index c745ee1b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/images/winXPOlive.PNG +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor/plugin.xml deleted file mode 100644 index 1b67021c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/plugin.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - id="product" - point="org.eclipse.core.runtime.products"> - <product - application="org.eclipse.e4.ui.workbench.swt.E4Application" - name="ModelEditor"> - <property - name="appName" - value="ModelEditor"> - </property> - <property - name="applicationXMI" - value="org.eclipse.e4.tools.emf.editor/Application.e4xmi"> - </property> - <property - name="applicationCSS" - value="org.eclipse.e4.tools.emf.editor.theme"> - </property> - <property - name="applicationCSSResources" - value="platform:/plugin/org.eclipse.e4.tools.emf.editor/images/"> - </property> - </product> - </extension> - <extension - point="org.eclipse.e4.ui.css.swt.theme"> - <theme - basestylesheeturi="css/e4_default.css" - id="org.eclipse.e4.tools.emf.editor.theme" - label="Application Theme"> - </theme> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewApplicationModelHandler.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewApplicationModelHandler.java deleted file mode 100644 index 075f6797..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewApplicationModelHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor; - - -import java.io.IOException; - -import javax.inject.Named; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; - -@SuppressWarnings("restriction") -public class NewApplicationModelHandler { - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MApplication application, EModelService modelService) { - FileDialog dialog = new FileDialog(shell,SWT.SAVE); - String file = dialog.open(); - if( file != null ) { - String name = file.substring(file.lastIndexOf("/") + 1); - String filePath = "file://" + file; - - try { - E4XMIResource resource = new E4XMIResource(); - resource.getContents().add((EObject) MApplicationFactory.INSTANCE.createApplication()); - resource.setURI(URI.createFileURI(file)); - resource.save(null); - - MPartStack stack = (MPartStack) modelService.find("modeleditorstack", application); - - MInputPart part = MBasicFactory.INSTANCE.createInputPart(); - part.setLabel(name); - part.setTooltip(file); - part.setContributionURI("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); - part.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png"); - part.setInputURI(filePath); - - part.setCloseable(true); - stack.getChildren().add(part); - stack.setSelectedElement(part); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewModelContributionHandler.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewModelContributionHandler.java deleted file mode 100644 index a610f488..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/NewModelContributionHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.eclipse.e4.tools.emf.editor; - -import java.io.IOException; - -import javax.inject.Named; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; - -public class NewModelContributionHandler { - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MApplication application, EModelService modelService) { - FileDialog dialog = new FileDialog(shell,SWT.SAVE); - String file = dialog.open(); - if( file != null ) { - String name = file.substring(file.lastIndexOf("/") + 1); - String filePath = "file://" + file; - - try { - E4XMIResource resource = new E4XMIResource(); - resource.getContents().add((EObject) MFragmentFactory.INSTANCE.createModelFragments()); - resource.setURI(URI.createFileURI(file)); - resource.save(null); - - System.err.println("Saved to: " + file); - - MPartStack stack = (MPartStack) modelService.find("modeleditorstack", application); - - MInputPart part = MBasicFactory.INSTANCE.createInputPart(); - part.setLabel(name); - part.setTooltip(file); - part.setContributionURI("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); - part.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png"); - part.setInputURI(filePath); - - part.setCloseable(true); - stack.getChildren().add(part); - stack.setSelectedElement(part); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/OpenModelFileHandler.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/OpenModelFileHandler.java deleted file mode 100644 index 0e8895ec..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/OpenModelFileHandler.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor; - -import java.util.Collection; - -import javax.inject.Named; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.e4.ui.model.application.ui.basic.MPartStack; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.workbench.modeling.EModelService; -import org.eclipse.e4.ui.workbench.modeling.EPartService; -import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Shell; - -public class OpenModelFileHandler { - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, MApplication application, EModelService modelService, EPartService partService) { - System.err.println("Execute!"); - FileDialog dialog = new FileDialog(shell); - String file = dialog.open(); - if( file != null ) { - String name = file.substring(file.lastIndexOf("/") + 1); - String filePath = "file://" + file; - Collection<MInputPart> parts = partService.getInputParts(filePath); - if( parts.size() == 0 ) { - MPartStack stack = (MPartStack) modelService.find("org.eclipse.e4.tools.emf.editor.mainwindow.editorstack", application); - - try { - MInputPart part = MBasicFactory.INSTANCE.createInputPart(); - part.setLabel(name); - part.setTooltip(file); - part.setContributionURI("platform:/plugin/org.eclipse.e4.tools.emf.ui/org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor"); - part.setIconURI("platform:/plugin/org.eclipse.e4.tools.emf.editor/icons/full/application_view_tile.png"); - part.setInputURI(filePath); - - part.setCloseable(true); - stack.getChildren().add(part); - stack.setSelectedElement(part); - System.err.println("Done"); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - partService.showPart(parts.iterator().next(), PartState.ACTIVATE); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SaveModelFileHandler.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SaveModelFileHandler.java deleted file mode 100644 index 7aacb884..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SaveModelFileHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor; - -import javax.inject.Named; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.workbench.modeling.EPartService; - -public class SaveModelFileHandler { - @Execute - public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, EPartService partService) { - partService.savePart(part, false); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SelectionProviderContextFunction.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SelectionProviderContextFunction.java deleted file mode 100644 index 8dc1fa26..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/SelectionProviderContextFunction.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.e4.tools.emf.editor; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; -import org.eclipse.e4.ui.services.IServiceConstants; - -public class SelectionProviderContextFunction extends ContextFunction { - - @Override - public Object compute(final IEclipseContext context) { - return new ISelectionProviderService() { - - public void setSelection(Object selection) { - context.set(IServiceConstants.SELECTION, selection); - } - }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/XMIResourceFunction.java deleted file mode 100644 index f3cc4b91..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor/src/org/eclipse/e4/tools/emf/editor/XMIResourceFunction.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.eclipse.e4.tools.emf.editor; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; -import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; -import org.eclipse.e4.ui.model.application.ui.basic.MInputPart; -import org.eclipse.emf.common.util.URI; - -public class XMIResourceFunction extends ContextFunction { - - @Override - public Object compute(IEclipseContext context) { - final MInputPart part = context.get(MInputPart.class); - if( part != null ) { - final XMIModelResource resource = new XMIModelResource(URI.createURI(part.getInputURI())); - resource.addModelListener(new ModelListener() { - - public void dirtyChanged() { - part.setDirty(resource.isDirty()); - } - - public void commandStackChanged() { - - } - }); - return resource; - } - - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath b/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.project b/bundles/org.eclipse.e4.tools.emf.editor3x/.project deleted file mode 100644 index 6682b79a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.editor3x</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index df1b497b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Mar 14 13:37:58 CET 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF deleted file mode 100644 index e69d0595..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Editor3x -Bundle-SymbolicName: org.eclipse.e4.tools.emf.editor3x;singleton:=true -Bundle-Version: 0.9.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.ui;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0", - org.eclipse.emf.common;bundle-version="2.6.0", - org.eclipse.core.databinding.observable;bundle-version="1.3.0", - org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.css.core;bundle-version="0.9.0", - org.eclipse.e4.ui.css.swt;bundle-version="0.9.1", - org.w3c.css.sac;bundle-version="1.3.0", - org.eclipse.pde.core;bundle-version="3.6.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.ui.ide;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.e4.tools.compat;bundle-version="1.0.0", - org.eclipse.e4.tools.services;bundle-version="1.0.0" -Service-Component: OSGI-INF/pdecontributionprovider.xml, OSGI-INF/xmiresourcecontextfunction.xml, OSGI-INF/projectfunction.xml -Bundle-ActivationPolicy: lazy -Export-Package: org.eclipse.e4.tools.emf.editor3x.wizard;x-internal:=true diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml deleted file mode 100644 index ce78958e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/pdecontributionprovider.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.pdecontrib"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.PDEClassContributionProvider"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml deleted file mode 100644 index ed7571e8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/projectfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.projectfunction"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.EditorProjectFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.editorproject"/> -</scr:component>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml deleted file mode 100644 index 07c42709..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/OSGI-INF/xmiresourcecontextfunction.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.editor3x.contextfunction"> - <implementation class="org.eclipse.e4.tools.emf.editor3x.XMIResourceFunction"/> - <service> - <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/> - </service> - <property name="service.context.key" type="String" value="org.eclipse.e4.tools.emf.ui.common.IModelResource"/> -</scr:component>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/about.html b/bundles/org.eclipse.e4.tools.emf.editor3x/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties deleted file mode 100644 index 4f0aef77..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - OSGI-INF/ -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/application_view_tile.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png b/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png Binary files differdeleted file mode 100644 index 6187b15a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/icons/full/obj16/plugin.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml b/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml deleted file mode 100644 index dc050c95..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/plugin.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.ui.editors"> - <editor - class="org.eclipse.e4.tools.emf.editor3x.E4WorkbenchModelEditor" - default="true" - extensions="e4xmi" - icon="icons/full/obj16/application_view_tile.png" - id="org.eclipse.e4.tools.emf.editor3x.e4wbm" - name="e4 Workbenchmodel Editor"> - </editor> - </extension> - <extension - point="org.eclipse.ui.newWizards"> - <wizard - canFinishEarly="false" - category="org.eclipse.e4" - class="org.eclipse.e4.tools.emf.editor3x.wizard.NewApplicationModelWizard" - hasPages="true" - icon="icons/full/obj16/application_view_tile.png" - id="org.eclipse.e4.tools.emf.editor3x.newappmodel" - name="New Application Model"> - </wizard> - - <wizard - canFinishEarly="false" - category="org.eclipse.e4" - class="org.eclipse.e4.tools.emf.editor3x.wizard.NewContributionModelWizard" - hasPages="true" - icon="icons/full/obj16/plugin.png" - id="org.eclipse.e4.tools.emf.editor3x.newmodelcontribution" - name="New Model Fragment"> - </wizard> - <category - id="org.eclipse.e4" - name="e4"> - </category> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java deleted file mode 100644 index 3484bed5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/E4WorkbenchModelEditor.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.compat.parts.DIEditorPart; -import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; - -@SuppressWarnings("restriction") -public class E4WorkbenchModelEditor extends DIEditorPart<ApplicationModelEditor> { - - public E4WorkbenchModelEditor() { - super(ApplicationModelEditor.class); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java deleted file mode 100644 index c99606b5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/EditorProjectFunction.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; - -public class EditorProjectFunction extends ContextFunction { - - @Override - public Object compute(IEclipseContext context) { - final IEditorInput input = context.get(IEditorInput.class); - if( input != null ) { - return ((IFileEditorInput)input).getFile().getProject(); - } - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java deleted file mode 100644 index cf55a477..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.search.IJavaSearchConstants; -import org.eclipse.jdt.core.search.IJavaSearchScope; -import org.eclipse.jdt.core.search.SearchEngine; -import org.eclipse.jdt.core.search.SearchPattern; -import org.eclipse.jdt.core.search.TypeNameRequestor; -import org.eclipse.pde.internal.core.util.PDEJavaHelper; - -public class PDEClassContributionProvider implements IClassContributionProvider { - private SearchEngine searchEngine; - public PDEClassContributionProvider() { - searchEngine = new SearchEngine(); - } - - @SuppressWarnings("restriction") - public void findContribution(final Filter filter, final ContributionResultHandler handler) { - System.err.println("Searching for: " + filter.namePattern); - - IJavaSearchScope scope = PDEJavaHelper.getSearchScope(filter.project); - - char[] packageName = null; - char[] typeName = null; - String currentContent = filter.namePattern; - int index = currentContent.lastIndexOf('.'); - - if (index == -1) { - // There is no package qualification - // Perform the search only on the type name - typeName = currentContent.toCharArray(); - } else if ((index + 1) == currentContent.length()) { - // There is a package qualification and the last character is a - // dot - // Perform the search for all types under the given package - // Pattern for all types - typeName = "".toCharArray(); //$NON-NLS-1$ - // Package name without the trailing dot - packageName = currentContent.substring(0, index).toCharArray(); - } else { - // There is a package qualification, followed by a dot, and - // a type fragment - // Type name without the package qualification - typeName = currentContent.substring(index + 1).toCharArray(); - // Package name without the trailing dot - packageName = currentContent.substring(0, index).toCharArray(); - } - -// char[] packageName = "at.bestsolution.e4.handlers".toCharArray(); -// char[] typeName = "*".toCharArray(); - - TypeNameRequestor req = new TypeNameRequestor() { - public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { - // Accept search results from the JDT SearchEngine - String cName = new String(simpleTypeName); - String pName = new String(packageName); -// String label = cName + " - " + pName; //$NON-NLS-1$ - String content = pName + "." + cName; //$NON-NLS-1$ - -// System.err.println("Found: " + label + " => " + pName + " => " + path); - - IResource resource = filter.project.getWorkspace().getRoot().findMember(path); - - if( resource != null ) { - IProject project = resource.getProject(); - IFile f = project.getFile("/META-INF/MANIFEST.MF"); - - if( f != null && f.exists() ) { - BufferedReader r = null; - try { - InputStream s = f.getContents(); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while( (line = r.readLine()) != null ) { - if( line.startsWith("Bundle-SymbolicName:") ) { - int start = line.indexOf(':'); - int end = line.indexOf(';'); - if( end == -1 ) { - end = line.length(); - } - ContributionData data = new ContributionData(line.substring(start+1,end).trim(), content, "Java", null); - handler.result(data); - break; - } - } - - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if( r != null ) { - try { - r.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - } - - - //Image image = (Flags.isInterface(modifiers)) ? PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); - //addProposalToCollection(c, startOffset, length, label, content, image); - } - }; - - try { - searchEngine.searchAllTypeNames( - packageName, - SearchPattern.R_EXACT_MATCH, - typeName, - SearchPattern.R_PREFIX_MATCH, - IJavaSearchConstants.CLASS, - scope, - req, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); - } catch (JavaModelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java deleted file mode 100644 index 36c0b85a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.jface.action.Action; - -public class RedoAction extends Action { - private final IModelResource resource; - private final IModelResource.ModelListener listener; - - public RedoAction(IModelResource resource) { - this.resource = resource; - this.listener = new IModelResource.ModelListener() { - - public void commandStackChanged() { - update(); - } - - public void dirtyChanged() { - - } - - }; - resource.addModelListener(listener); - update(); - } - - @Override - public void run() { - if (resource.getEditingDomain().getCommandStack().canRedo()) { - resource.getEditingDomain().getCommandStack().redo(); - } - } - - private void update() { - if (resource.getEditingDomain().getCommandStack().canRedo()) { - setText("Redo " - + resource.getEditingDomain().getCommandStack() - .getRedoCommand().getLabel()); - setEnabled(true); - } else { - setText("Redo"); - setEnabled(false); - } - } - - /** - * Clean up - */ - public void dispose() { - resource.removeModelListener(listener); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java deleted file mode 100644 index 6988d3d1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.jface.action.Action; - -public class UndoAction extends Action { - private final IModelResource resource; - private final IModelResource.ModelListener listener; - - public UndoAction(IModelResource resource) { - this.resource = resource; - this.listener = new IModelResource.ModelListener() { - - public void commandStackChanged() { - update(); - } - - public void dirtyChanged() { - } - }; - resource.addModelListener(listener); - update(); - } - - @Override - public void run() { - if (resource.getEditingDomain().getCommandStack().canUndo()) { - resource.getEditingDomain().getCommandStack().undo(); - } - } - - private void update() { - if (resource.getEditingDomain().getCommandStack().canUndo()) { - setText("Undo " - + resource.getEditingDomain().getCommandStack() - .getUndoCommand().getLabel()); - setEnabled(true); - } else { - setText("Undo"); - setEnabled(false); - } - } - - /** - * Clean up - */ - public void dispose() { - resource.removeModelListener(listener); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java deleted file mode 100644 index a19ed76d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIModelResource.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x; - -import java.util.ArrayList; -import java.util.EventObject; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; - -@SuppressWarnings("restriction") -public class XMIModelResource implements IModelResource { - private EditingDomain editingDomain; - private Resource resource; - private List<ModelListener> listeners = new ArrayList<IModelResource.ModelListener>(); - private boolean dirty; - - - public XMIModelResource(URI uri) { - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - ResourceSet resourceSet = new ResourceSetImpl(); - BasicCommandStack commandStack = new BasicCommandStack(); - commandStack.addCommandStackListener(new CommandStackListener() { - - public void commandStackChanged(EventObject event) { - dirty = true; - fireDirtyChanged(); - fireCommandStackChanged(); - } - }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, - commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new E4XMIResourceFactory()); - resource = resourceSet.getResource(uri, true); - } - - public IObservableList getRoot() { - WritableList list = new WritableList(); - list.add(resource.getContents().get(0)); - return list; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public boolean isSaveable() { - return true; - } - - public void addModelListener(ModelListener listener) { - listeners.add(listener); - } - - public void removeModelListener(ModelListener listener) { - listeners.remove(listener); - } - - public boolean isDirty() { - return dirty && getEditingDomain().getCommandStack().canUndo(); - } - - private void fireDirtyChanged() { - for( ModelListener listener : listeners ) { - listener.dirtyChanged(); - } - } - - private void fireCommandStackChanged() { - for( ModelListener listener : listeners ) { - listener.commandStackChanged(); - } - } - - public IStatus save() { - Map<String, String> map = new HashMap<String, String>(); - try { - resource.save(map); - editingDomain.getCommandStack().flush(); - dirty = false; - fireDirtyChanged(); - fireCommandStackChanged(); - } catch (Exception e) { - // TODO: handle exception - e.printStackTrace(); - } - - return Status.OK_STATUS; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java deleted file mode 100644 index 2b64fcb8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/XMIResourceFunction.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x; - -import org.eclipse.e4.core.contexts.ContextFunction; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.tools.emf.editor3x.emf.EditUIUtil; -import org.eclipse.e4.tools.emf.ui.common.IModelResource.ModelListener; -import org.eclipse.e4.tools.emf.ui.common.XMIModelResource; -import org.eclipse.e4.tools.services.IDirtyProviderService; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; - -public class XMIResourceFunction extends ContextFunction { - - @Override - public Object compute(final IEclipseContext context) { - final IEditorInput input = context.get(IEditorInput.class); - final IDirtyProviderService dirtyProvider = context.get(IDirtyProviderService.class); - - if( input != null ) { - URI resourceURI = EditUIUtil.getURI(input); - final XMIModelResource resource = new XMIModelResource(resourceURI); - resource.addModelListener(new ModelListener() { - - public void dirtyChanged() { - dirtyProvider.setDirtyState(resource.isDirty()); - } - - public void commandStackChanged() { - - } - }); - return resource; - } - - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java deleted file mode 100644 index 39074b03..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.eclipse.e4.tools.emf.editor3x.emf; - -import java.lang.reflect.Method; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IURIEditorInput; -import org.osgi.framework.Bundle; - -public class EditUIUtil { - static final Class<?> FILE_CLASS; - static { - Class<?> fileClass = null; - try { - fileClass = IFile.class; - } catch (Throwable exception) { - // Ignore any exceptions and assume the class isn't available. - } - FILE_CLASS = fileClass; - } - - static final Class<?> FILE_REVISION_CLASS; - static final Method FILE_REVISION_GET_URI_METHOD; - static { - Class<?> fileRevisionClass = null; - Method fileRevisionGetURIMethod = null; - Bundle bundle = Platform.getBundle("org.eclipse.team.core"); - if (bundle != null - && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0) { - try { - fileRevisionClass = bundle - .loadClass("org.eclipse.team.core.history.IFileRevision"); - fileRevisionGetURIMethod = fileRevisionClass - .getMethod("getURI"); - } catch (Throwable exeption) { - // Ignore any exceptions and assume the class isn't available. - } - } - FILE_REVISION_CLASS = fileRevisionClass; - FILE_REVISION_GET_URI_METHOD = fileRevisionGetURIMethod; - } - - static final Class<?> URI_EDITOR_INPUT_CLASS; - static { - Class<?> uriEditorInputClass = null; - try { - uriEditorInputClass = IURIEditorInput.class; - } catch (Throwable exception) { - // The class is not available. - } - URI_EDITOR_INPUT_CLASS = uriEditorInputClass; - } - - public static URI getURI(IEditorInput editorInput) { - - if (FILE_CLASS != null) { - IFile file = (IFile) editorInput.getAdapter(FILE_CLASS); - if (file != null) { - return URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); - } - } - if (FILE_REVISION_CLASS != null) { - Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS); - if (fileRevision != null) { - try { - return URI - .createURI(((java.net.URI) FILE_REVISION_GET_URI_METHOD - .invoke(fileRevision)).toString()); - } catch (Throwable exception) { - // TODO Log error - } - } - } - if (URI_EDITOR_INPUT_CLASS != null) { - if (editorInput instanceof IURIEditorInput) { - return URI.createURI( - ((IURIEditorInput) editorInput).getURI().toString()) - .trimFragment(); - } - } - - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java deleted file mode 100644 index 27d175bf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/BaseApplicationModelWizard.java +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWizard; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -public abstract class BaseApplicationModelWizard extends Wizard implements INewWizard { - private NewModelFilePage page; - private ISelection selection; - - protected IWorkbench workbench; - - /** - * Constructor for NewApplicationModelWizard. - */ - public BaseApplicationModelWizard() { - super(); - setNeedsProgressMonitor(true); - } - - /** - * Adding the page to the wizard. - */ - - public void addPages() { - page = new NewModelFilePage(selection,getDefaultFileName()); - addPage(page); - } - - public abstract String getDefaultFileName(); - - @Override - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = - new WorkspaceModifyOperation() { - @Override - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - resource.save(options); - } - catch (Exception exception) { - throw new RuntimeException(exception); - } - finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - ((ISetSelectionTarget)activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor - (new FileEditorInput(modelFile), - workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } - catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), "Could not init editor", exception.getMessage()); //$NON-NLS-1$ - return false; - } - - return true; - } - catch (Exception exception) { - MessageDialog.openError(getShell(), "Error", exception.getMessage()); - return false; - } - } - - protected abstract EObject createInitialModel(); - - private IFile getModelFile() throws CoreException { - String containerName = page.getContainerName(); - String fileName = page.getFileName(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource resource = root.findMember(new Path(containerName)); - if (!resource.exists() || !(resource instanceof IContainer)) { - throwCoreException("Container \"" + containerName - + "\" does not exist."); - } - IContainer container = (IContainer) resource; - return container.getFile(new Path(fileName)); - } - - private void throwCoreException(String message) throws CoreException { - IStatus status = new Status(IStatus.ERROR, - "org.eclipse.e4.tools.emf.editor3x", IStatus.OK, message, null); - throw new CoreException(status); - } - - /** - * We will accept the selection in the workbench to see if we can initialize - * from it. - * - * @see IWorkbenchWizard#init(IWorkbench, IStructuredSelection) - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java deleted file mode 100644 index ed161a7e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewApplicationModelWizard.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.emf.ecore.EObject; - - -public class NewApplicationModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "Application.e4xmi"; - } - - protected EObject createInitialModel() { - return (EObject) MApplicationFactory.INSTANCE.createApplication(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java deleted file mode 100644 index 20b95dd2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewContributionModelWizard.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; -import org.eclipse.emf.ecore.EObject; - - -public class NewContributionModelWizard extends BaseApplicationModelWizard { - - @Override - public String getDefaultFileName() { - return "fragment.e4xmi"; - } - - protected EObject createInitialModel() { - return (EObject) MFragmentFactory.INSTANCE.createModelFragments(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java deleted file mode 100644 index 90154bad..00000000 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/wizard/NewModelFilePage.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.editor3x.wizard; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.IDialogPage; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; - -/** - * The "New" wizard page allows setting the container for the new file as well - * as the file name. The page will only accept file name without the extension - * OR with the extension that matches the expected one (e4xmi). - */ - -public class NewModelFilePage extends WizardPage { - private Text containerText; - - private Text fileText; - - private ISelection selection; - - private String defaultFilename; - - /** - * Constructor for SampleNewWizardPage. - * - * @param pageName - */ - public NewModelFilePage(ISelection selection, String defaultFilename) { - super("wizardPage"); - setTitle("Multi-page Editor File"); - setDescription("This wizard creates a new file with *.e4xmi extension that can be opened by a multi-page editor."); - this.selection = selection; - this.defaultFilename = defaultFilename; - } - - /** - * @see IDialogPage#createControl(Composite) - */ - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 3; - layout.verticalSpacing = 9; - Label label = new Label(container, SWT.NULL); - label.setText("&Container:"); - - containerText = new Text(container, SWT.BORDER | SWT.SINGLE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - containerText.setLayoutData(gd); - containerText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - - Button button = new Button(container, SWT.PUSH); - button.setText("Browse..."); - button.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - handleBrowse(); - } - }); - label = new Label(container, SWT.NULL); - label.setText("&File name:"); - - fileText = new Text(container, SWT.BORDER | SWT.SINGLE); - gd = new GridData(GridData.FILL_HORIZONTAL); - fileText.setLayoutData(gd); - fileText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - dialogChanged(); - } - }); - initialize(); - dialogChanged(); - setControl(container); - } - - /** - * Tests if the current workbench selection is a suitable container to use. - */ - - private void initialize() { - if (selection != null && selection.isEmpty() == false - && selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() > 1) - return; - Object obj = ssel.getFirstElement(); - if (obj instanceof IResource) { - IContainer container; - if (obj instanceof IContainer) - container = (IContainer) obj; - else - container = ((IResource) obj).getParent(); - containerText.setText(container.getFullPath().toString()); - } - } - fileText.setText(defaultFilename); - } - - /** - * Uses the standard container selection dialog to choose the new value for - * the container field. - */ - - private void handleBrowse() { - ContainerSelectionDialog dialog = new ContainerSelectionDialog( - getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, - "Select new file container"); - if (dialog.open() == ContainerSelectionDialog.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - containerText.setText(((Path) result[0]).toString()); - } - } - } - - /** - * Ensures that both text fields are set. - */ - - private void dialogChanged() { - IResource container = ResourcesPlugin.getWorkspace().getRoot() - .findMember(new Path(getContainerName())); - String fileName = getFileName(); - - if (getContainerName().length() == 0) { - updateStatus("File container must be specified"); - return; - } - if (container == null - || (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) { - updateStatus("File container must exist"); - return; - } - if (!container.isAccessible()) { - updateStatus("Project must be writable"); - return; - } - if (fileName.length() == 0) { - updateStatus("File name must be specified"); - return; - } - if (fileName.replace('\\', '/').indexOf('/', 1) > 0) { - updateStatus("File name must be valid"); - return; - } - int dotLoc = fileName.lastIndexOf('.'); - if (dotLoc != -1) { - String ext = fileName.substring(dotLoc + 1); - if (ext.equalsIgnoreCase("e4xmi") == false) { - updateStatus("File extension must be \"e4xmi\""); - return; - } - } - updateStatus(null); - } - - private void updateStatus(String message) { - setErrorMessage(message); - setPageComplete(message == null); - } - - public String getContainerName() { - return containerText.getText(); - } - - public String getFileName() { - return fileText.getText(); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/.classpath b/bundles/org.eclipse.e4.tools.emf.liveeditor/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/.project b/bundles/org.eclipse.e4.tools.emf.liveeditor/.project deleted file mode 100644 index e796110f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.liveeditor</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.liveeditor/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5bf6d1cf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sun Mar 14 18:18:29 CET 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF deleted file mode 100644 index 87b851a9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/META-INF/MANIFEST.MF +++ /dev/null @@ -1,18 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Liveeditor -Bundle-SymbolicName: org.eclipse.e4.tools.emf.liveeditor;singleton:=true -Bundle-Version: 0.9.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: javax.inject;bundle-version="1.0.0", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.swt;bundle-version="3.6.0", - org.eclipse.e4.tools.emf.ui;bundle-version="0.9.0", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.core.databinding.observable;bundle-version="1.3.0", - org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0" diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/build.properties b/bundles/org.eclipse.e4.tools.emf.liveeditor/build.properties deleted file mode 100644 index e9863e28..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/plugin.xml b/bundles/org.eclipse.e4.tools.emf.liveeditor/plugin.xml deleted file mode 100644 index 5e6b541b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - id="id1" - point="org.eclipse.e4.workbench.model"> - <processor - beforefragment="true" - class="org.eclipse.e4.tools.emf.liveeditor.ModelProcessor"> - </processor> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/MemoryModelResource.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/MemoryModelResource.java deleted file mode 100644 index d93e9fee..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/MemoryModelResource.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.liveeditor; - - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; - -public class MemoryModelResource implements IModelResource { - private WritableList list = new WritableList(); - private EditingDomain editingDomain; - - public MemoryModelResource(MApplication application) { - list.add(application); - BasicCommandStack commandStack = new BasicCommandStack(); - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack); - } - - public IObservableList getRoot() { - return list; - } - - public boolean isSaveable() { - return false; - } - - public IStatus save() { - return Status.OK_STATUS; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public boolean isDirty() { - return false; - } - - public void addModelListener(ModelListener listener) { - - } - - public void removeModelListener(ModelListener listener) { - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java deleted file mode 100644 index a649726a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/ModelProcessor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.liveeditor; - -import javax.inject.Inject; - -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; - -public class ModelProcessor { - - @Execute - public void process(MApplication application) { - MCommand command = MCommandsFactory.INSTANCE.createCommand(); - command.setElementId("e4.tooling.livemodel"); - command.setCommandName("Show running app model"); - command.setDescription("Show the running application model"); - application.getCommands().add(command); - - MHandler handler = MCommandsFactory.INSTANCE.createHandler(); - handler.setContributionURI("platform:/plugin/org.eclipse.e4.tools.emf.liveeditor/org.eclipse.e4.tools.emf.liveeditor.OpenLiveDialogHandler"); - handler.setCommand(command); - application.getHandlers().add(handler); - - MKeyBinding binding = MCommandsFactory.INSTANCE.createKeyBinding(); - binding.setKeySequence("ALT+SHIFT+F9"); - binding.setCommand(command); - if( application.getBindingTables().size() > 0 ) { - application.getBindingTables().get(0).getBindings().add(binding); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java b/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java deleted file mode 100644 index 630ae811..00000000 --- a/bundles/org.eclipse.e4.tools.emf.liveeditor/src/org/eclipse/e4/tools/emf/liveeditor/OpenLiveDialogHandler.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.liveeditor; - -import javax.inject.Named; - -import org.eclipse.e4.core.contexts.ContextInjectionFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Execute; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.wbm.ApplicationModelEditor; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.services.IServiceConstants; -import org.eclipse.e4.ui.services.IStylingEngine; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; - -public class OpenLiveDialogHandler { - private Shell shell; - - public OpenLiveDialogHandler() { - System.err.println("Created Live Dialog Handler"); - } - - @Execute - public void run(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, - IEclipseContext context, MApplication application, IStylingEngine engine) { - if (this.shell == null || ! this.shell.isDisposed()) { - try { - shell = new Shell(shell.getDisplay(),SWT.ON_TOP|SWT.SHELL_TRIM); - //FIXME Style - shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - FillLayout layout = new FillLayout(); - layout.marginHeight=10; - layout.marginWidth=10; - shell.setLayout(layout); - final IEclipseContext childContext = context - .createChild("EditorContext"); - MemoryModelResource resource = new MemoryModelResource(application); - childContext.set(IModelResource.class, resource); - childContext.set(Composite.class.getName(), shell); - childContext.set(IModelResource.class, resource); - - ContextInjectionFactory.make(ApplicationModelEditor.class, childContext); - -// new ApplicationModelEditor(shell, childContext, resource, null); - shell.open(); - shell.addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - childContext.dispose(); - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.classpath b/bundles/org.eclipse.e4.tools.emf.ui/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.project b/bundles/org.eclipse.e4.tools.emf.ui/.project deleted file mode 100644 index b7697e08..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.project +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.emf.ui</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ds.core.builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 118f2dfe..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,335 +0,0 @@ -#Mon Jun 21 15:26:11 CEST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=80 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 2e80c9eb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,61 +0,0 @@ -#Sat Jun 26 16:51:30 CEST 2010 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_custom -formatter_settings_version=11 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs b/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs deleted file mode 100644 index 497f55a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/.settings/org.eclipse.pde.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -#Sun Apr 18 16:26:38 CEST 2010 -eclipse.preferences.version=1 -pluginProject.extensions=true -resolve.requirebundle=false diff --git a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF deleted file mode 100644 index bd341a40..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,41 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true -Bundle-Version: 0.9.0.qualifier -Bundle-ClassPath: . -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.databinding;bundle-version="1.3.0", - org.eclipse.core.databinding.property;bundle-version="1.2.100", - org.eclipse.e4.ui.model.workbench;bundle-version="0.9.1", - org.eclipse.emf.databinding;bundle-version="1.2.0", - org.eclipse.jface.databinding;bundle-version="1.4.0", - org.eclipse.jface;bundle-version="3.6.0", - org.eclipse.emf.edit;bundle-version="2.6.0", - org.eclipse.equinox.common;bundle-version="3.6.0", - org.eclipse.emf.databinding.edit;bundle-version="1.2.0", - org.eclipse.core.resources;bundle-version="3.6.0", - org.eclipse.e4.core.services;bundle-version="0.9.1", - org.eclipse.osgi;bundle-version="3.6.0", - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.9.0", - org.eclipse.e4.core.di;bundle-version="0.9.0", - org.eclipse.e4.ui.workbench;bundle-version="0.9.1", - org.eclipse.e4.ui.services;bundle-version="0.9.1", - org.eclipse.equinox.registry;bundle-version="3.5.0", - org.eclipse.e4.core.contexts;bundle-version="0.9.0", - org.eclipse.e4.ui.di;bundle-version="0.9.0", - javax.annotation;bundle-version="1.0.0" -Bundle-ActivationPolicy: lazy -Import-Package: javax.inject;version="1.0.0", - org.eclipse.core.runtime.jobs, - org.osgi.framework;version="1.5.0" -Export-Package: org.eclipse.e4.tools.emf.ui.common, - org.eclipse.e4.tools.emf.ui.common.component, - org.eclipse.e4.tools.emf.ui.internal;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;x-internal:=true, - org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor" -Service-Component: OSGI-INF/contributioncollector.xml diff --git a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml b/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml deleted file mode 100644 index 42e124fe..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/OSGI-INF/contributioncollector.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.e4.tools.emf.ui"> - <implementation class="org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector"/> - <reference bind="addContributor" cardinality="0..n" interface="org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider" name="IClassContributionProvider" policy="dynamic" unbind="removeContributor"/> - <service> - <provide interface="org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector"/> - </service> -</scr:component> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/about.html b/bundles/org.eclipse.e4.tools.emf.ui/about.html deleted file mode 100644 index c1343aa3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/about.html +++ /dev/null @@ -1,45 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>December 3, 2009</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. -For purposes of the EPL, "Program" will mean the Content.</p> - -<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> - -<h3>Third Party Content</h3> - -<p>The Content includes items from third parties as set out below. If you did not -receive this Content directly from the Eclipse Foundation, the following is provided for informational -purposes only, and you should look to the Redistributor’s license for terms and conditions of use.</p> - -<h4>Silk icon set Version 1.3</h4> -<p> -This plugin contains icons from the Silk icon set created by Mark James. The original files can -be found at: -<ul> -<a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a></ul> -<p>The license can be found at:</p> -<ul> - <li><a href="http://creativecommons.org/licenses/by/2.5/">http://creativecommons.org/licenses/by/2.5/</a></li> -</ul> - -</body> -</html>
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/build.properties b/bundles/org.eclipse.e4.tools.emf.ui/build.properties deleted file mode 100644 index 0ab8a444..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -bin.includes = .,\ - META-INF/,\ - plugin.properties,\ - icons/,\ - about.html,\ - OSGI-INF/contributioncollector.xml,\ - plugin.xml,\ - css/ -output.. = bin/ -jars.compile.order = . -source.. = src/ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css b/bundles/org.eclipse.e4.tools.emf.ui/css/default.css deleted file mode 100644 index 2117aec7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/css/default.css +++ /dev/null @@ -1,27 +0,0 @@ -.headerSectionContainer { - background-color: gradient #575757 #101010 100%; -} - -.sectionHeader { - font-weight: bold; - font-size: 15pt; - color: white; -} - -.subSectionHeader { - background-color: gradient #575757 #101010 100%; -} - - -.contentContainer { - background-color: #fff #fff #cccccc 20% 80%; -} - -.formContainer { - background-color: #fff; -} - -/* SingleSourcing Container */ -.E4WorkbenchModelEditor { - background-color: #fff; -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png Binary files differdeleted file mode 100644 index 3262767c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png Binary files differdeleted file mode 100644 index 3bc0bd32..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png Binary files differdeleted file mode 100644 index decac8a6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif Binary files differdeleted file mode 100644 index c3193fd9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif Binary files differdeleted file mode 100644 index 30dbf6b0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif Binary files differdeleted file mode 100644 index b225cd5e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif Binary files differdeleted file mode 100644 index 710188a9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif Binary files differdeleted file mode 100644 index ac4ff211..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif Binary files differdeleted file mode 100644 index 57f41022..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif Binary files differdeleted file mode 100644 index d289b194..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif Binary files differdeleted file mode 100644 index 2b692560..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif Binary files differdeleted file mode 100644 index b7c3c562..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif Binary files differdeleted file mode 100644 index 16d63ff2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png Binary files differdeleted file mode 100644 index 6187b15a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif Binary files differdeleted file mode 100644 index 610f5844..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif Binary files differdeleted file mode 100644 index 7a31c506..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartDescriptor.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif Binary files differdeleted file mode 100644 index bbbdd559..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif Binary files differdeleted file mode 100644 index 013e818e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif Binary files differdeleted file mode 100644 index edd6060d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif Binary files differdeleted file mode 100644 index ba1a1998..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif Binary files differdeleted file mode 100644 index 0624021b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif Binary files differdeleted file mode 100644 index 25c66a18..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png Binary files differdeleted file mode 100644 index b6cb0ecf..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif Binary files differdeleted file mode 100644 index 64173281..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif Binary files differdeleted file mode 100644 index 59155918..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif Binary files differdeleted file mode 100644 index 81d54f31..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif Binary files differdeleted file mode 100644 index 3e53cbdc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif Binary files differdeleted file mode 100644 index 59155918..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif Binary files differdeleted file mode 100644 index 37aad784..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif Binary files differdeleted file mode 100644 index 37aad784..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif Binary files differdeleted file mode 100644 index 30c5c10c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/EPackage.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png Binary files differdeleted file mode 100644 index 2c4e2793..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_down.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png Binary files differdeleted file mode 100644 index 1ebb1932..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/arrow_up.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif Binary files differdeleted file mode 100644 index e4c2a836..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/class_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif Binary files differdeleted file mode 100644 index d4cb4254..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/field_public_obj.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png Binary files differdeleted file mode 100644 index 45c29000..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/headermenu.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png Binary files differdeleted file mode 100644 index 2a3e5c4d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_add.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png Binary files differdeleted file mode 100644 index b85916d9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/table_delete.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png Binary files differdeleted file mode 100644 index 908612e3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/zoom.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png Binary files differdeleted file mode 100644 index ff2dae47..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/fieldrefact_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png Binary files differdeleted file mode 100644 index 732631c0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/import_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png Binary files differdeleted file mode 100644 index cc123864..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newclass_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png Binary files differdeleted file mode 100644 index a473ea86..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/newexp_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png Binary files differdeleted file mode 100644 index 6cd52a58..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/wizban/typerefact_wiz.png +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties b/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties deleted file mode 100644 index 14a799fb..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.properties +++ /dev/null @@ -1,8 +0,0 @@ - -# <copyright> -# </copyright> -# -# $Id$ - -pluginName = EMFUI Model -providerName = www.example.org diff --git a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml b/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml deleted file mode 100644 index b3cd9703..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/plugin.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension-point id="org.eclipse.e4.tools.emf.ui.editors" name="Editors" schema="schema/org.eclipse.e4.tools.emf.ui.editors.exsd"/> - <extension - point="org.eclipse.e4.ui.css.swt.theme"> - <stylesheet - uri="css/default.css"> - </stylesheet> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd b/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd deleted file mode 100644 index 57b8c96b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/schema/org.eclipse.e4.tools.emf.ui.editors.exsd +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.e4.tools.emf.ui" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.e4.tools.emf.ui" id="org.eclipse.e4.tools.emf.ui.editors" name="Editors"/> - </appinfo> - <documentation> - [Enter description of this extension point.] - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence> - <element ref="editor" minOccurs="0" maxOccurs="unbounded"/> - <element ref="virtualeditor" minOccurs="0" maxOccurs="unbounded"/> - <element ref="editorfeature" minOccurs="0" maxOccurs="unbounded"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="editor"> - <complexType> - <attribute name="descriptorClass" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="virtualeditor"> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn="org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor:"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="editorfeature"> - <complexType> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute kind="java" basedOn=":org.eclipse.e4.tools.emf.ui.common.IEditorFeature"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java deleted file mode 100644 index 2b3b836c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/EStackLayout.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Composite; - -import org.eclipse.swt.custom.StackLayout; - -public class EStackLayout extends StackLayout { - private boolean onlyVisible; - - public EStackLayout() { - this(true); - } - - public EStackLayout(boolean onlyVisible) { - this.onlyVisible = onlyVisible; - } - - @Override - protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { - if( topControl != null && onlyVisible ) { - int maxWidth = 0; - int maxHeight = 0; - Point size = topControl.computeSize(wHint, hHint, flushCache); - maxWidth = Math.max(size.x, maxWidth); - maxHeight = Math.max(size.y, maxHeight); - int width = maxWidth + 2 * marginWidth; - int height = maxHeight + 2 * marginHeight; - if (wHint != SWT.DEFAULT) width = wHint; - if (hHint != SWT.DEFAULT) height = hHint; - return new Point(width, height); - } - return super.computeSize(composite, wHint, hHint, flushCache); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java deleted file mode 100644 index 53383e00..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IClassContributionProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.resources.IProject; - -public interface IClassContributionProvider { - public class ContributionData { - public final String bundleName; - public final String className; - public final String sourceType; - public final String iconPath; - - public ContributionData(String bundleName, String className, String sourceType, String iconPath) { - this.bundleName = bundleName; - this.className = className; - this.sourceType = sourceType; - this.iconPath = iconPath; - } - } - - public class Filter { - public final IProject project; - public final String namePattern; - - public Filter(IProject project, String namePattern) { - this.project = project; - this.namePattern = namePattern; - } - } - - public interface ContributionResultHandler { - public void result(ContributionData data); - } - - public void findContribution(Filter filter, ContributionResultHandler handler); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java deleted file mode 100644 index de57bc4a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorDescriptor.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.emf.ecore.EClass; - -public interface IEditorDescriptor { - public EClass getEClass(); - public Class<?> getEditorClass(); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java deleted file mode 100644 index cf0411f9..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IEditorFeature.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.emf.ecore.EStructuralFeature; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; - -public interface IEditorFeature { - public class FeatureClass { - public final String label; - public final EClass eClass; - - public FeatureClass(String label, EClass eClass) { - this.label = label; - this.eClass = eClass; - } - } - public List<FeatureClass> getFeatureClasses(EClass eClass, EStructuralFeature feature); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java deleted file mode 100644 index 4c5d0aca..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/IModelResource.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.edit.domain.EditingDomain; - -public interface IModelResource { - public IObservableList getRoot(); - public boolean isSaveable(); - public IStatus save(); - public EditingDomain getEditingDomain(); - public boolean isDirty(); - - public void addModelListener(ModelListener listener); - public void removeModelListener(ModelListener listener); - - public interface ModelListener { - public void dirtyChanged(); - public void commandStackChanged(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java deleted file mode 100644 index 3c1d3d5f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ISelectionProviderService.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -public interface ISelectionProviderService { - public void setSelection(Object selection); -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java deleted file mode 100644 index 87251ca5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/ImageTooltip.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import java.io.FileNotFoundException; - -import java.text.DecimalFormat; - -import java.text.NumberFormat; - -import java.io.ByteArrayInputStream; - -import org.eclipse.swt.graphics.ImageData; - -import java.io.ByteArrayOutputStream; - -import org.eclipse.swt.layout.GridLayout; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.jface.resource.JFaceResources; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.swt.graphics.Font; - -import org.eclipse.swt.widgets.Label; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; - -import org.eclipse.swt.widgets.Control; - -import org.eclipse.jface.window.ToolTip; - -public abstract class ImageTooltip extends ToolTip { - private Image image; - - public ImageTooltip(Control control) { - super(control); - - } - - @Override - protected boolean shouldCreateToolTip(Event event) { - if( getImageURI() != null ) { - return super.shouldCreateToolTip(event); - } - return false; - } - - @Override - protected Composite createToolTipContentArea(Event event, Composite parent) { - clearResources(); - parent = new Composite(parent, SWT.NONE); - parent.setBackground(event.widget.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); - parent.setBackgroundMode(SWT.INHERIT_DEFAULT); - parent.setLayout(new GridLayout(2, false)); - - URI uri = getImageURI(); - - if( uri != null ) { - int fileSize = -1; - ByteArrayOutputStream out = null; - InputStream stream = null; - InputStream bStream = null; - String errorMessage = "<Unknow Error>"; - try { - URL url = new URL(uri.toString()); - stream = url.openStream(); - - if( stream != null ) { - out = new ByteArrayOutputStream(); - byte[] buf = new byte[1024]; - int length; - while( ( length = stream.read(buf)) != -1 ) { - out.write(buf,0,length); - } - fileSize = out.size(); - bStream = new ByteArrayInputStream(out.toByteArray()); - image = new Image(parent.getDisplay(),bStream); - } - } catch (MalformedURLException e) { - errorMessage = e.getMessage(); - } catch (FileNotFoundException e) { - if( uri.isPlatform() ) { - errorMessage = "File '" + e.getMessage() + "' not found in bundle '"+uri.segment(1)+"'"; - } else { - errorMessage = e.getMessage(); - } - } catch (IOException e) { - errorMessage = e.getMessage(); - } catch(Exception e) { - errorMessage = e.getMessage(); - }finally { - if(out != null) { - try { - out.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if( bStream != null ) { - try { - bStream.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if( stream != null ) { - try { - stream.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - // --------------------------------- - Label l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Icon:"); - - l = new Label(parent,SWT.NONE); - if( image == null ) { - System.err.println(errorMessage); - l.setText(errorMessage); - } else { - l.setImage(image); - } - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Name:"); - - l = new Label(parent,SWT.NONE); - l.setText(uri.lastSegment()); - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("Dimensions:"); - - l = new Label(parent,SWT.NONE); - if( image != null ) { - l.setText(image.getBounds().width + "x" + image.getBounds().height+" px"); - } else { - l.setText("0x0 px"); - } - - - // --------------------------------- - - l = new Label(parent, SWT.NONE); - l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); - l.setText("File-Size:"); - - l = new Label(parent,SWT.NONE); - l.setText( new DecimalFormat("#,##0.00").format((fileSize / 1024.0)) + "KB" ); - } - - return parent; - } - - @Override - protected void afterHideToolTip(Event event) { - super.afterHideToolTip(event); - clearResources(); - } - - protected abstract URI getImageURI(); - - private void clearResources() { - if( image != null ) { - image.dispose(); - image = null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java deleted file mode 100644 index 19d535ce..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.common; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.emf.ecore.EObject; - -public class Util { - public static final boolean isNullOrEmpty(String element) { - return element == null || element.trim().length() == 0; - } - - public static final boolean isImport(EObject object) { - return object.eContainingFeature() == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java deleted file mode 100644 index aa8bae4b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common; - -import java.util.ArrayList; -import java.util.EventObject; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.e4.ui.internal.workbench.E4XMIResourceFactory; -import org.eclipse.emf.common.command.BasicCommandStack; -import org.eclipse.emf.common.command.CommandStackListener; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; - -@SuppressWarnings("restriction") -public class XMIModelResource implements IModelResource { - private EditingDomain editingDomain; - private Resource resource; - private List<ModelListener> listeners = new ArrayList<IModelResource.ModelListener>(); - private boolean dirty; - - - public XMIModelResource(URI uri) { - ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory( - ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - ResourceSet resourceSet = new ResourceSetImpl(); - BasicCommandStack commandStack = new BasicCommandStack(); - commandStack.addCommandStackListener(new CommandStackListener() { - - public void commandStackChanged(EventObject event) { - dirty = true; - fireDirtyChanged(); - fireCommandStackChanged(); - } - }); - editingDomain = new AdapterFactoryEditingDomain(adapterFactory, - commandStack, resourceSet); - resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap() - .put(Resource.Factory.Registry.DEFAULT_EXTENSION, - new E4XMIResourceFactory()); - resource = resourceSet.getResource(uri, true); - } - - public IObservableList getRoot() { - WritableList list = new WritableList(); - list.add(resource.getContents().get(0)); - return list; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public boolean isSaveable() { - return true; - } - - public void addModelListener(ModelListener listener) { - listeners.add(listener); - } - - public void removeModelListener(ModelListener listener) { - listeners.remove(listener); - } - - public boolean isDirty() { - return dirty && getEditingDomain().getCommandStack().canUndo(); - } - - private void fireDirtyChanged() { - for( ModelListener listener : listeners ) { - listener.dirtyChanged(); - } - } - - private void fireCommandStackChanged() { - for( ModelListener listener : listeners ) { - listener.commandStackChanged(); - } - } - - public IStatus save() { - Map<String, String> map = new HashMap<String, String>(); - try { - resource.save(map); - editingDomain.getCommandStack().flush(); - dirty = false; - fireDirtyChanged(); - fireCommandStackChanged(); - } catch (Exception e) { - // TODO: handle exception - e.printStackTrace(); - } - - return Status.OK_STATUS; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java deleted file mode 100644 index 5ca17b80..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.common.component; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -public abstract class AbstractComponentEditor { - private EditingDomain editingDomain; - - private static Map<Integer, Image> IMAGE_MAP = new HashMap<Integer, Image>(); - private static final String[] IMAGES = { "/icons/full/obj16/zoom.png", //$NON-NLS-1$ - "/icons/full/obj16/table_add.png", //$NON-NLS-1$ - "/icons/full/obj16/table_delete.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_up.png", //$NON-NLS-1$ - "/icons/full/obj16/arrow_down.png" //$NON-NLS-1$ - }; - - private WritableValue master = new WritableValue(); - - public static final int SEARCH_IMAGE = 0; - public static final int TABLE_ADD_IMAGE = 1; - public static final int TABLE_DELETE_IMAGE = 2; - public static final int ARROW_UP = 3; - public static final int ARROW_DOWN = 4; - - protected static final int VERTICAL_LIST_WIDGET_INDENT = 10; - - private ModelEditor editor; - - public AbstractComponentEditor(EditingDomain editingDomain, ModelEditor editor) { - this.editingDomain = editingDomain; - this.editor = editor; - } - - public EditingDomain getEditingDomain() { - return editingDomain; - } - - public ModelEditor getEditor() { - return editor; - } - - public WritableValue getMaster() { - return master; - } - - public Image getImage(Display d, int id) { - Image img = IMAGE_MAP.get(id); - if (img == null) { - try { - InputStream in = AbstractComponentEditor.class.getClassLoader().getResourceAsStream(IMAGES[id]); - img = new Image(d, in); - IMAGE_MAP.put(id, img); - in.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return img; - } - - public abstract Image getImage(Object element, Display display); - - public abstract String getLabel(Object element); - - public abstract String getDetailLabel(Object element); - - public abstract String getDescription(Object element); - - public abstract Composite getEditor(Composite parent, Object object); - - public abstract IObservableList getChildList(Object element); - - protected Image loadSharedImage(Display d, URL path) { - try { - URL url = FileLocator.resolve(path); - if (url != null) { - InputStream in = url.openStream(); - Image image = new Image(d, in); - in.close(); - return image; - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] {}; - } - - public List<Action> getActions(Object element) { - return Collections.emptyList(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java deleted file mode 100644 index 1460779f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java +++ /dev/null @@ -1,359 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages { - public static String AbstractCommandSelectionDialog_Label_CommandId; - - public static String ApplicationEditor_Label; - public static String ApplicationEditor_Description; - public static String ApplicationEditor_Id; - public static String ApplicationEditor_Handlers; - public static String ApplicationEditor_PartDescriptors; - public static String ApplicationEditor_BindingTables; - public static String ApplicationEditor_Commands; - public static String ApplicationEditor_Windows; - public static String ApplicationEditor_Addons; - public static String ApplicationEditor_MenuContributions; - public static String ApplicationEditor_ToolBarContributions; - public static String ApplicationEditor_TrimContributions; - - public static String BindingTableEditor_Label; - public static String BindingTableEditor_Description; - public static String BindingTableEditor_Id; - public static String BindingTableEditor_ContextId; - public static String BindingTableEditor_Find; - public static String BindingTableEditor_Keybindings; - public static String BindingTableEditor_KeySequence; - public static String BindingTableEditor_Command; - public static String BindingTableEditor_Up; - public static String BindingTableEditor_Down; - public static String BindingTableEditor_Add; - public static String BindingTableEditor_Remove; - - public static String CommandEditor_Label; - public static String CommandEditor_Description; - public static String CommandEditor_Id; - public static String CommandEditor_Name; - public static String CommandEditor_LabelDescription; - public static String CommandEditor_Parameters; - public static String CommandEditor_ParameterName; - public static String CommandEditor_ParameterTypeId; - public static String CommandEditor_ParameterOptional; - public static String CommandEditor_ParameterOptional_No; - public static String CommandEditor_ParameterOptional_Yes; - public static String CommandEditor_Up; - public static String CommandEditor_Down; - public static String CommandEditor_Add; - public static String CommandEditor_Remove; - public static String CommandEditor_ParameterId; - - public static String DirectMenuItemEditor_Label; - public static String DirectMenuItemEditor_Description; - public static String DirectMenuItemEditor_ClassURI; - public static String DirectMenuItemEditor_Find; - - public static String ControlFactory_BindingContexts; - public static String ControlFactory_Add; - public static String ControlFactory_Up; - public static String ControlFactory_Down; - public static String ControlFactory_Remove; - public static String ControlFactory_Tags; - public static String ControlFactory_Key; - public static String ControlFactory_Value; - public static String ControlFactory_ContextVariables; - public static String ControlFactory_AddNoEllipse; - - public static String DirectToolItemEditor_ClassURI; - public static String DirectToolItemEditor_Find; - public static String DirectToolItemEditor_Label; - public static String DirectToolItemEditor_Description; - - public static String HandledMenuItemEditor_Label; - public static String HandledMenuItemEditor_Description; - public static String HandledMenuItemEditor_Command; - public static String HandledMenuItemEditor_Find; - public static String HandledMenuItemEditor_Parameters; - public static String HandledMenuItemEditor_Tag; - public static String HandledMenuItemEditor_Value; - public static String HandledMenuItemEditor_Up; - public static String HandledMenuItemEditor_Down; - public static String HandledMenuItemEditor_Add; - public static String HandledMenuItemEditor_Remove; - - public static String HandledToolItemEditor_Command; - public static String HandledToolItemEditor_Find; - public static String HandledToolItemEditor_Parameters; - public static String HandledToolItemEditor_ParametersName; - public static String HandledToolItemEditor_ParametersValue; - public static String HandledToolItemEditor_Up; - public static String HandledToolItemEditor_Down; - public static String HandledToolItemEditor_Add; - public static String HandledToolItemEditor_Remove; - public static String HandledToolItemEditor_Label; - public static String HandledToolItemEditor_Description; - - public static String HandlerEditor_Label; - public static String HandlerEditor_Description; - public static String HandlerEditor_Id; - public static String HandlerEditor_Command; - public static String HandlerEditor_Find; - public static String HandlerEditor_ClassURI; - - public static String InputPartEditor_Label; - public static String InputPartEditor_InputURI; - - public static String KeyBindingEditor_Label; - public static String KeyBindingEditor_Description; - public static String KeyBindingEditor_Id; - public static String KeyBindingEditor_Sequence; - public static String KeyBindingEditor_Command; - public static String KeyBindingEditor_Find; - public static String KeyBindingEditor_Parameters; - public static String KeyBindingEditor_ParametersKey; - public static String KeyBindingEditor_ParametersValue; - public static String KeyBindingEditor_Up; - public static String KeyBindingEditor_Down; - public static String KeyBindingEditor_Add; - public static String KeyBindingEditor_Remove; - - public static String MenuEditor_Label; - public static String MenuEditor_Description; - public static String MenuEditor_Id; - public static String MenuEditor_MenuItems; - public static String MenuEditor_MenuItemType; - public static String MenuEditor_MenuItemItemType; - public static String MenuEditor_Up; - public static String MenuEditor_Down; - public static String MenuEditor_HandledMenuItem; - public static String MenuEditor_Separator; - public static String MenuEditor_Menu; - public static String MenuEditor_DirectMenuItem; - public static String MenuEditor_Remove; - public static String MenuEditor_LabelLabel; - public static String MenuEditor_Tooltip; - public static String MenuEditor_IconURI; - - public static String MenuItemEditor_Id; - public static String MenuItemEditor_Type; - public static String MenuItemEditor_Label; - public static String MenuItemEditor_Tooltip; - public static String MenuItemEditor_IconURI; - public static String MenuItemEditor_Find; - public static String MenuEditor_MainMenu; - - public static String MenuSeparatorEditor_Label; - public static String MenuSeparatorEditor_Id; - - public static String ModelComponentEditor_Id; - public static String ModelComponentEditor_ParentId; - public static String ModelComponentEditor_Find; - public static String ModelComponentEditor_PositionInParent; - public static String ModelComponentEditor_Processor; - public static String ModelComponentEditor_Tags; - public static String ModelComponentEditor_Label; - public static String ModelComponentEditor_Description; - public static String ModelComponentEditor_Handlers; - public static String ModelComponentEditor_BindingTables; - public static String ModelComponentEditor_KeyBindings; - public static String ModelComponentEditor_Commands; - public static String ModelComponentEditor_Menus; - public static String ModelComponentEditor_UiChildren; - public static String ModelComponentEditor_PartDescriptors; - public static String ModelComponentEditor_DetailParentId; - public static String ModelComponentEditor_MenuContributions; - - public static String ModelComponentsEditor_Label; - public static String ModelComponentsEditor_Description; - public static String ModelComponentsEditor_ModelContributions; - public static String ModelComponentsEditor_Up; - public static String ModelComponentsEditor_Down; - public static String ModelComponentsEditor_Add; - public static String ModelComponentsEditor_Remove; - - public static String PartDescriptorEditor_Label; - public static String PartDescriptorEditor_Descriptor; - public static String PartDescriptorEditor_Id; - public static String PartDescriptorEditor_LabelLabel; - public static String PartDescriptorEditor_Tooltip; - public static String PartDescriptorEditor_IconURI; - public static String PartDescriptorEditor_Find; - public static String PartDescriptorEditor_ClassURI; - public static String PartDescriptorEditor_Dirtyable; - public static String PartDescriptorEditor_Closeable; - public static String PartDescriptorEditor_Multiple; - public static String PartDescriptorEditor_Category; - public static String PartDescriptorEditor_PersitedState; - public static String PartDescriptorEditor_PersitedStateKey; - public static String PartDescriptorEditor_PersitedStateValue; - public static String PartDescriptorEditor_Add; - public static String PartDescriptorEditor_Remove; - public static String PartDescriptorEditor_Variables; - public static String PartDescriptorEditor_Properties; - public static String PartDescriptorEditor_PropertiesKey; - public static String PartDescriptorEditor_PropertiesValue; - public static String PartDescriptorEditor_Menus; - public static String PartDescriptorEditor_Handlers; - public static String PartDescriptorEditor_ContainerData; - - public static String PartEditor_Label; - public static String PartEditor_Description; - public static String PartEditor_Id; - public static String PartEditor_LabelLabel; - public static String PartEditor_Tooltip; - public static String PartEditor_IconURI; - public static String PartEditor_Find; - public static String PartEditor_ClassURI; - public static String PartEditor_Closeable; - public static String PartEditor_PersitedState; - public static String PartEditor_PersitedStateKey; - public static String PartEditor_PersitedStateValue; - public static String PartEditor_Add; - public static String PartEditor_Remove; - public static String PartEditor_Menus; - public static String PartEditor_Handlers; - public static String PartEditor_ContainerData; - public static String PartEditor_ToolBar; - - public static String PartSashContainerEditor_Label; - public static String PartSashContainerEditor_Description; - public static String PartSashContainerEditor_Id; - public static String PartSashContainerEditor_Orientation; - public static String PartSashContainerEditor_Vertical; - public static String PartSashContainerEditor_Horizontal; - public static String PartSashContainerEditor_SelectedElement; - public static String PartSashContainerEditor_Controls; - public static String PartSashContainerEditor_Up; - public static String PartSashContainerEditor_Down; - public static String PartSashContainerEditor_Remove; - public static String PartSashContainerEditor_ContainerData; - - public static String PartStackEditor_Label; - public static String PartStackEditor_Description; - public static String PartStackEditor_Id; - public static String PartStackEditor_SelectedElement; - public static String PartStackEditor_Parts; - public static String PartStackEditor_Up; - public static String PartStackEditor_Down; - public static String PartStackEditor_Remove; - public static String PartStackEditor_ContainerData; - public static String PerspectiveStackEditor_Add; - - public static String PerspectiveEditor_Label; - public static String PerspectiveEditor_Description; - public static String PerspectiveEditor_Id; - public static String PerspectiveEditor_LabelLabel; - public static String PerspectiveEditor_SelectedElement; - public static String PerspectiveEditor_Tooltip; - public static String PerspectiveEditor_IconURI; - public static String PerspectiveEditor_Find; - public static String PerspectiveEditor_Controls; - public static String PerspectiveEditor_Up; - public static String PerspectiveEditor_Down; - public static String PerspectiveEditor_Remove; - - public static String PerspectiveStackEditor_Perspectives; - public static String PerspectiveStackEditor_Label; - public static String PerspectiveStackEditor_Description; - public static String PerspectiveStackEditor_Id; - public static String PerspectiveStackEditor_SelectedElement; - - public static String PlaceholderEditor_Label; - public static String PlaceholderEditor_Descriptor; - public static String PlaceholderEditor_Id; - public static String PlaceholderEditor_FindReference; - - public static String ToolBarEditor_Label; - public static String ToolBarEditor_Description; - public static String ToolBarEditor_Id; - public static String ToolBarEditor_ToolbarItems; - public static String ToolBarEditor_ToolbarItemsType; - public static String ToolBarEditor_ToolbarItemsItemType; - public static String ToolBarEditor_Up; - public static String ToolBarEditor_Down; - public static String ToolBarEditor_HandledToolItem; - public static String ToolBarEditor_DirectToolItem; - public static String ToolBarEditor_ToolControl; - public static String ToolBarEditor_Separator; - public static String ToolBarEditor_Remove; - - public static String ToolBarSeparatorEditor_Label; - public static String ToolBarSeparatorEditor_Id; - - public static String ToolControlEditor_Label; - public static String ToolControlEditor_Description; - public static String ToolControlEditor_Id; - public static String ToolControlEditor_ClassURI; - - public static String VBindingTableEditor_Label; - public static String VBindingTableEditor_Description; - public static String VBindingTableEditor_Contexts; - public static String VBindingTableEditor_Name; - public static String VBindingTableEditor_LabelDescription; - public static String VBindingTableEditor_Id; - public static String VBindingTableEditor_Up; - public static String VBindingTableEditor_Down; - public static String VBindingTableEditor_Add; - public static String VBindingTableEditor_Remove; - - public static String AddonsEditor_Id; - public static String AddonsEditor_ClassURI; - public static String AddonsEditor_Find; - - public static String ContributionClassDialog_DialogMessage; - public static String ContributionClassDialog_DialogTitle; - public static String ContributionClassDialog_Label_Classname; - public static String ContributionClassDialog_ShellTitle; - - public static String MenuContributionEditor_Id; - public static String MenuContributionEditor_MenuItems; - public static String MenuContributionEditor_MenuItemType; - public static String MenuContributionEditor_MenuItemItemType; - public static String MenuContributionEditor_Up; - public static String MenuContributionEditor_Down; - public static String MenuContributionEditor_HandledMenuItem; - public static String MenuContributionEditor_Separator; - public static String MenuContributionEditor_Menu; - public static String MenuContributionEditor_DirectMenuItem; - public static String MenuContributionEditor_Remove; - public static String MenuContributionEditor_ParentId; - public static String MenuContributionEditor_Position; - - public static String ModelFragmentsEditor_ModelFragments; - public static String ModelFragmentsEditor_Up; - public static String ModelFragmentsEditor_Down; - public static String ModelFragmentsEditor_Add; - public static String ModelFragmentsEditor_Remove; - public static String ModelFragmentsEditor_Label; - public static String ModelFragmentsEditor_Description; - - public static String StringModelFragment_Label; - public static String StringModelFragment_Description; - public static String StringModelFragment_Featurename; - public static String StringModelFragment_ParentId; - public static String StringModelFragment_PositionInList; - public static String StringModelFragment_Up; - public static String StringModelFragment_Down; - public static String StringModelFragment_Remove; - public static String StringModelFragment_Elements; - public static String StringModelFragment_Find; - - public static String FeatureSelectionDialog_Filter; - public static String FeatureSelectionDialog_ShellTitle; - public static String FeatureSelectionDialog_DialogTitle; - public static String FeatureSelectionDialog_DialogMessage; - - static { - NLS.initializeMessages(Messages.class.getName(), Messages.class); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties deleted file mode 100644 index efb9a055..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties +++ /dev/null @@ -1,351 +0,0 @@ -# ****************************************************************************** -# * Copyright (c) 2010 BestSolution.at and others. -# * All rights reserved. This program and the accompanying materials -# * are made available under the terms of the Eclipse Public License v1.0 -# * which accompanies this distribution, and is available at -# * http://www.eclipse.org/legal/epl-v10.html -# * -# * Contributors: -# * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation -# ****************************************************************************** -AbstractCommandSelectionDialog_Label_CommandId=Command-Id - -ApplicationEditor_Label=Application -ApplicationEditor_Description=Application bla, bla, bla -ApplicationEditor_Id=Id -ApplicationEditor_Handlers=Handlers -ApplicationEditor_PartDescriptors=Part Descriptors -ApplicationEditor_BindingTables=BindingTables -ApplicationEditor_Commands=Commands -ApplicationEditor_Windows=Windows -ApplicationEditor_Addons=Addons -ApplicationEditor_MenuContributions=Menu Contributions -ApplicationEditor_ToolBarContributions=Toolbar Contributions -ApplicationEditor_TrimContributions=Trim Contributions - -BindingTableEditor_Label=BindingTable -BindingTableEditor_Description=BindingTable bla bla bla -BindingTableEditor_Id=Id -BindingTableEditor_ContextId=Context Id -BindingTableEditor_Find=Find ... -BindingTableEditor_Keybindings=Keybindings -BindingTableEditor_KeySequence=KeySequence -BindingTableEditor_Command=Command -BindingTableEditor_Up=Up -BindingTableEditor_Down=Down -BindingTableEditor_Add=Add ... -BindingTableEditor_Remove=Remove - -CommandEditor_Label=Command -CommandEditor_Description=Command bla bla bla -CommandEditor_Id=Id -CommandEditor_Name=Name -CommandEditor_LabelDescription=Description -CommandEditor_Parameters=Parameters -CommandEditor_ParameterName=Name -CommandEditor_ParameterTypeId=Type-Id -CommandEditor_ParameterOptional=Optional -CommandEditor_ParameterOptional_Yes=yes -CommandEditor_ParameterOptional_No=no -CommandEditor_Up=Up -CommandEditor_Down=Down -CommandEditor_Add=Add ... -CommandEditor_Remove=Remove -CommandEditor_ParameterId=Id - -DirectMenuItemEditor_Label=DirectMenuItem -DirectMenuItemEditor_Description=DirectMenuItem bla bla bla -DirectMenuItemEditor_ClassURI=Class URI -DirectMenuItemEditor_Find=Find ... - -ControlFactory_BindingContexts=Binding Contexts -ControlFactory_Add=Add ... -ControlFactory_Up=Up -ControlFactory_Down=Down -ControlFactory_Remove=Remove -ControlFactory_Tags=Tags -ControlFactory_Key=Key -ControlFactory_Value=Value -ControlFactory_ContextVariables=Context Variables -ControlFactory_AddNoEllipse=Add - -DirectToolItemEditor_ClassURI=Class URI -DirectToolItemEditor_Find=Find ... -DirectToolItemEditor_Label=Direct Tool Item -DirectToolItemEditor_Description=Direct Tool Item bla bla bla - -HandledMenuItemEditor_Label=HandledMenuItem -HandledMenuItemEditor_Description=HandledMenuItem bla bla bla -HandledMenuItemEditor_Command=Command -HandledMenuItemEditor_Find=Find ... -HandledMenuItemEditor_Parameters=Parameters -HandledMenuItemEditor_Tag=Name -HandledMenuItemEditor_Value=Value -HandledMenuItemEditor_Up=Up -HandledMenuItemEditor_Down=Down -HandledMenuItemEditor_Add=Add ... -HandledMenuItemEditor_Remove=Remove - -HandledToolItemEditor_Command=Command -HandledToolItemEditor_Find=Find ... -HandledToolItemEditor_Parameters=Parameters -HandledToolItemEditor_ParametersName=Name -HandledToolItemEditor_ParametersValue=Value -HandledToolItemEditor_Up=Up -HandledToolItemEditor_Down=Down -HandledToolItemEditor_Add=Add ... -HandledToolItemEditor_Remove=Remove -HandledToolItemEditor_Label=Handled Tool Item -HandledToolItemEditor_Description=Handled Tool Item bla bla bla - -HandlerEditor_Label=Handler -HandlerEditor_Description=Handler bla bla bla -HandlerEditor_Id=Id -HandlerEditor_Command=Command -HandlerEditor_Find=Find ... -HandlerEditor_ClassURI=Class URI - -InputPartEditor_Label=InputPart -InputPartEditor_InputURI=Input URI - -KeyBindingEditor_Label=Binding -KeyBindingEditor_Description=Binding bla bla bla -KeyBindingEditor_Id=Id -KeyBindingEditor_Sequence=Sequence -KeyBindingEditor_Command=Command -KeyBindingEditor_Find=Find ... -KeyBindingEditor_Parameters=Parameters -KeyBindingEditor_ParametersKey=Key -KeyBindingEditor_ParametersValue=Value -KeyBindingEditor_Up=Up -KeyBindingEditor_Down=Down -KeyBindingEditor_Add=Add ... -KeyBindingEditor_Remove=Remove - -MenuEditor_Label=Menu -MenuEditor_Description=Menu bla bla bla -MenuEditor_Id=Id -MenuEditor_MenuItems=MenuItems -MenuEditor_MenuItemType=Type -MenuEditor_MenuItemItemType=Item Type -MenuEditor_Up=Up -MenuEditor_Down=Down -MenuEditor_HandledMenuItem=Handled MenuItem -MenuEditor_Separator=Separator -MenuEditor_Menu=Menu -MenuEditor_Remove=Remove -MenuEditor_DirectMenuItem=Direct MenuItem -MenuEditor_LabelLabel=Label -MenuEditor_Tooltip=Tooltip -MenuEditor_IconURI=Icon URI -MenuEditor_MainMenu=Main Menu - -MenuItemEditor_Id=Id -MenuItemEditor_Type=Type -MenuItemEditor_Label=Label -MenuItemEditor_Tooltip=Tooltip -MenuItemEditor_IconURI=Icon URI -MenuItemEditor_Find=Find ... - - -MenuSeparatorEditor_Label=Separator -MenuSeparatorEditor_Id=Id - -ModelComponentEditor_Id=Id -ModelComponentEditor_ParentId=Parent-Id -ModelComponentEditor_Find=Find ... -ModelComponentEditor_PositionInParent=Position in Parent -ModelComponentEditor_Processor=Processor -ModelComponentEditor_Tags=Tags -ModelComponentEditor_Label=Model Component -ModelComponentEditor_Description=The model component ... bla bla bla -ModelComponentEditor_Handlers=Handlers -ModelComponentEditor_BindingTables=BindingTables -ModelComponentEditor_KeyBindings=KeyBindings -ModelComponentEditor_Commands=Commands -ModelComponentEditor_Menus=Menus -ModelComponentEditor_UiChildren=UI-Children -ModelComponentEditor_PartDescriptors=PartDescriptors -ModelComponentEditor_DetailParentId=parentId -ModelComponentEditor_MenuContributions=MenuContributions - -ModelComponentsEditor_Label=Model Components -ModelComponentsEditor_Description=Some bla bla bla bla -ModelComponentsEditor_ModelContributions=Model Contributions -ModelComponentsEditor_Up=Up -ModelComponentsEditor_Down=Down -ModelComponentsEditor_Add=Add -ModelComponentsEditor_Remove=Remove - -PartDescriptorEditor_Label=PartDescriptor -PartDescriptorEditor_Descriptor=PartDescriptor Bla Bla Bla Bla -PartDescriptorEditor_Id=Id -PartDescriptorEditor_LabelLabel=Label -PartDescriptorEditor_Tooltip=Tooltip -PartDescriptorEditor_IconURI=Icon URI -PartDescriptorEditor_Find=Find ... -PartDescriptorEditor_ClassURI=Class URI -PartDescriptorEditor_Dirtyable=Dirtyable -PartDescriptorEditor_Closeable=Closeable -PartDescriptorEditor_Multiple=Multiple -PartDescriptorEditor_Category=Category -PartDescriptorEditor_PersitedState=Persited State -PartDescriptorEditor_PersitedStateKey=Key -PartDescriptorEditor_PersitedStateValue=Value -PartDescriptorEditor_Add=Add ... -PartDescriptorEditor_Remove=Remove -PartDescriptorEditor_Variables=Variables -PartDescriptorEditor_Properties=Properties -PartDescriptorEditor_PropertiesKey=Key -PartDescriptorEditor_PropertiesValue=Value -PartDescriptorEditor_Menus=Menus -PartDescriptorEditor_Handlers=Handlers -PartDescriptorEditor_ContainerData=Container Data - -PartEditor_Label=Part -PartEditor_Description=Part Bla Bla Bla Bla -PartEditor_Id=Id -PartEditor_LabelLabel=Label -PartEditor_Tooltip=Tooltip -PartEditor_IconURI=Icon URI -PartEditor_Find=Find ... -PartEditor_ClassURI=Class URI -PartEditor_Closeable=Closeable -PartEditor_PersitedState=Persisted State -PartEditor_PersitedStateKey=Key -PartEditor_PersitedStateValue=Value -PartEditor_Add=Add ... -PartEditor_Remove=Remove -PartEditor_Menus=Menus -PartEditor_Handlers=Handlers -PartEditor_ToolBar=ToolBar - -PartSashContainerEditor_Label=Sash -PartSashContainerEditor_Description=Sash bla bla bla -PartSashContainerEditor_Id=Id -PartSashContainerEditor_Orientation=Orientation -PartSashContainerEditor_Vertical=Vertical -PartSashContainerEditor_Horizontal=Horizontal -PartSashContainerEditor_SelectedElement=Selected Element -PartSashContainerEditor_Controls=Controls -PartSashContainerEditor_Up=Up -PartSashContainerEditor_Down=Down -PartSashContainerEditor_Remove=Remove -PartSashContainerEditor_ContainerData=Container Data - -PartStackEditor_Label=Part Stack -PartStackEditor_Description=Stack bla bla bla -PartStackEditor_Id=Id -PartStackEditor_SelectedElement=Selected Element -PartStackEditor_Parts=Parts -PartStackEditor_Up=Up -PartStackEditor_Down=Down -PartStackEditor_Remove=Remove -PartStackEditor_ContainerData=Container Data - -PerspectiveEditor_Label=Perspective -PerspectiveEditor_Description=Perspective Bla Bla Bla -PerspectiveEditor_Id=Id -PerspectiveEditor_LabelLabel=Label -PerspectiveEditor_SelectedElement=Selected Element -PerspectiveEditor_Label=Label -PerspectiveEditor_Tooltip=Tooltip -PerspectiveEditor_IconURI=Icon URI -PerspectiveEditor_Find=Find ... -PerspectiveEditor_Controls=Controls -PerspectiveEditor_Up=Up -PerspectiveEditor_Down=Down -PerspectiveEditor_Remove=Remove -PartEditor_ContainerData=Container Data - -PerspectiveStackEditor_Label=Perspective Stack -PerspectiveStackEditor_Description=Perspective Stack Bla Bla Bla -PerspectiveStackEditor_Id=Id -PerspectiveStackEditor_SelectedElement=Selected Element -PerspectiveStackEditor_Perspectives=Perspectives -PerspectiveStackEditor_Add=Add ... - -PlaceholderEditor_Label=Placeholder -PlaceholderEditor_Descriptor=Placeholder Bla Bla Bla Bla -PlaceholderEditor_Id=Id -PlaceholderEditor_FindReference=Find ... - -ToolBarEditor_Label=Toolbar -ToolBarEditor_Description=Toolbar bla bla bla -ToolBarEditor_Id=Id -ToolBarEditor_ToolbarItems=Toolbar Items -ToolBarEditor_ToolbarItemsType=Type -ToolBarEditor_ToolbarItemsItemType=Item-Type -ToolBarEditor_Up=Up -ToolBarEditor_Down=Down -ToolBarEditor_HandledToolItem=Handled ToolItem -ToolBarEditor_DirectToolItem=Direct ToolItem -ToolBarEditor_ToolControl=Tool Control -ToolBarEditor_Separator=Separator -ToolBarEditor_Remove=Remove - -ToolBarSeparatorEditor_Label=Separator -ToolBarSeparatorEditor_Id=Id - -ToolControlEditor_Label=ToolControl -ToolControlEditor_Description=ToolControl bla bla bla -ToolControlEditor_Id=Id -ToolControlEditor_ClassURI=Class URI - -VBindingTableEditor_Label=Binding Configuration -VBindingTableEditor_Description=Binding Configuration Bla Bla Bla Bla -VBindingTableEditor_Contexts=Contexts -VBindingTableEditor_Name=Name -VBindingTableEditor_LabelDescription=Description -VBindingTableEditor_Id=Id -VBindingTableEditor_Up=Up -VBindingTableEditor_Down=Down -VBindingTableEditor_Add=Add ... -VBindingTableEditor_Remove=Remove - -AddonsEditor_Id=Id -AddonsEditor_ClassURI=Class URI -AddonsEditor_Find=Find ... - -ContributionClassDialog_DialogMessage=Enter the name of the contributing class -ContributionClassDialog_DialogTitle=Find Contribution Class -ContributionClassDialog_Label_Classname=Classname -ContributionClassDialog_ShellTitle=Find Contribution Class - -MenuContributionEditor_Id=Id -MenuContributionEditor_MenuItems=Menu Items -MenuContributionEditor_MenuItemType=Type -MenuContributionEditor_MenuItemItemType=Item Type -MenuContributionEditor_Up=Up -MenuContributionEditor_Down=Down -MenuContributionEditor_HandledMenuItem=Handled MenuItem -MenuContributionEditor_Separator=Separator -MenuContributionEditor_Menu=Menu -MenuContributionEditor_DirectMenuItem=Direct MenuItem -MenuContributionEditor_Remove=Remove -MenuContributionEditor_ParentId=Parent-Id -MenuContributionEditor_Position=Position - -ModelFragmentsEditor_ModelFragments=Model Fragements -ModelFragmentsEditor_Up=Up -ModelFragmentsEditor_Down=Down -ModelFragmentsEditor_Add=Add -ModelFragmentsEditor_Remove=Remove -ModelFragmentsEditor_Label=Model Fragments -ModelFragmentsEditor_Description=Description - -StringModelFragment_Label=String Model Fragment -StringModelFragment_Description=String Model Fragment Bla Bla Bla -StringModelFragment_Featurename=Featurename -StringModelFragment_ParentId=Element Id -StringModelFragment_PositionInList=Position in list -StringModelFragment_Up=Up -StringModelFragment_Down=Down -StringModelFragment_Remove=Remove -StringModelFragment_Elements=Elements -StringModelFragment_Find=Find ... - -FeatureSelectionDialog_Filter=Filter -FeatureSelectionDialog_ShellTitle=Find Featurename -FeatureSelectionDialog_DialogTitle=Featurename -FeatureSelectionDialog_DialogMessage=Find the name of the feature you want to contribute to
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java deleted file mode 100644 index f5bdd1fe..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ObservableColumnLabelProvider.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import java.util.Set; -import org.eclipse.core.databinding.observable.map.IMapChangeListener; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.map.MapChangeEvent; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.LabelProviderChangedEvent; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; - -public class ObservableColumnLabelProvider<M> extends CellLabelProvider { - private IObservableMap[] attributeMaps; - - private IMapChangeListener mapChangeListener = new IMapChangeListener() { - public void handleMapChange(MapChangeEvent event) { - Set<?> affectedElements = event.diff.getChangedKeys(); - LabelProviderChangedEvent newEvent = new LabelProviderChangedEvent( - ObservableColumnLabelProvider.this, affectedElements - .toArray()); - fireLabelProviderChanged(newEvent); - } - }; - - /** - * Creates a new label provider that tracks changes to one attribute. - * - * @param attributeMap - */ - public ObservableColumnLabelProvider(IObservableMap attributeMap) { - this(new IObservableMap[] { attributeMap }); - } - - /** - * Creates a new label provider that tracks changes to more than one - * attribute. This constructor should be used by subclasses that override - * {@link #update(ViewerCell)} and make use of more than one attribute. - * - * @param attributeMaps - */ - protected ObservableColumnLabelProvider(IObservableMap[] attributeMaps) { - System.arraycopy(attributeMaps, 0, - this.attributeMaps = new IObservableMap[attributeMaps.length], - 0, attributeMaps.length); - for (int i = 0; i < attributeMaps.length; i++) { - attributeMaps[i].addMapChangeListener(mapChangeListener); - } - } - - public void dispose() { - for (int i = 0; i < attributeMaps.length; i++) { - attributeMaps[i].removeMapChangeListener(mapChangeListener); - } - super.dispose(); - this.attributeMaps = null; - this.mapChangeListener = null; - } - - @SuppressWarnings("unchecked") - public void update(ViewerCell cell) { - M element = (M) cell.getElement(); - cell.setText(getText(element)); - cell.setImage(getImage(element)); - cell.setBackground(getBackground(element)); - cell.setForeground(getForeground(element)); - cell.setFont(getFont(element)); - } - - public String getText(M element) { - Object value = attributeMaps[0].get(element); - return value == null ? "" : value.toString(); //$NON-NLS-1$ - } - - public Font getFont(M element) { - return null; - } - - public Color getBackground(M element) { - return null; - } - - public Color getForeground(M element) { - return null; - } - - - public Image getImage(M element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java deleted file mode 100644 index fbba0c09..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java +++ /dev/null @@ -1,354 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import java.text.BreakIterator; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * A filter used in conjunction with <code>FilteredTree</code>. In order to - * determine if a node should be filtered it uses the content and label provider - * of the tree to do pattern matching on its children. This causes the entire - * tree structure to be realized. Note that the label provider must implement - * ILabelProvider. - * - * @see org.eclipse.ui.dialogs.FilteredTree - * @since 3.2 - */ -public class PatternFilter extends ViewerFilter { - /* - * Cache of filtered elements in the tree - */ - private Map<Object,Object[]> cache = new HashMap<Object,Object[]>(); - - /* - * Maps parent elements to TRUE or FALSE - */ - private Map<Object,Boolean> foundAnyCache = new HashMap<Object,Boolean>(); - - private boolean useCache = false; - - /** - * Whether to include a leading wildcard for all provided patterns. A - * trailing wildcard is always included. - */ - private boolean includeLeadingWildcard = false; - - /** - * The string pattern matcher used for this pattern filter. - */ - private StringMatcher matcher; - - private boolean useEarlyReturnIfMatcherIsNull = true; - - private static Object[] EMPTY = new Object[0]; - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerFilter#filter(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object[]) - */ - public final Object[] filter(Viewer viewer, Object parent, Object[] elements) { - // we don't want to optimize if we've extended the filter ... this - // needs to be addressed in 3.4 - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404 - if (matcher == null && useEarlyReturnIfMatcherIsNull) { - return elements; - } - - if (!useCache) { - return super.filter(viewer, parent, elements); - } - - Object[] filtered = (Object[]) cache.get(parent); - if (filtered == null) { - Boolean foundAny = (Boolean) foundAnyCache.get(parent); - if (foundAny != null && !foundAny.booleanValue()) { - filtered = EMPTY; - } else { - filtered = super.filter(viewer, parent, elements); - } - cache.put(parent, filtered); - } - return filtered; - } - - /** - * Returns true if any of the elements makes it through the filter. - * This method uses caching if enabled; the computation is done in - * computeAnyVisible. - * - * @param viewer - * @param parent - * @param elements the elements (must not be an empty array) - * @return true if any of the elements makes it through the filter. - */ - private boolean isAnyVisible(Viewer viewer, Object parent, Object[] elements) { - if (matcher == null) { - return true; - } - - if (!useCache) { - return computeAnyVisible(viewer, elements); - } - - Object[] filtered = (Object[]) cache.get(parent); - if (filtered != null) { - return filtered.length > 0; - } - Boolean foundAny = (Boolean) foundAnyCache.get(parent); - if (foundAny == null) { - foundAny = computeAnyVisible(viewer, elements) ? Boolean.TRUE : Boolean.FALSE; - foundAnyCache.put(parent, foundAny); - } - return foundAny.booleanValue(); - } - - /** - * Returns true if any of the elements makes it through the filter. - * - * @param viewer the viewer - * @param elements the elements to test - * @return <code>true</code> if any of the elements makes it through the filter - */ - private boolean computeAnyVisible(Viewer viewer, Object[] elements) { - boolean elementFound = false; - for (int i = 0; i < elements.length && !elementFound; i++) { - Object element = elements[i]; - elementFound = isElementVisible(viewer, element); - } - return elementFound; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public final boolean select(Viewer viewer, Object parentElement, - Object element) { - return isElementVisible(viewer, element); - } - - /** - * Sets whether a leading wildcard should be attached to each pattern - * string. - * - * @param includeLeadingWildcard - * Whether a leading wildcard should be added. - */ - public final void setIncludeLeadingWildcard( - final boolean includeLeadingWildcard) { - this.includeLeadingWildcard = includeLeadingWildcard; - } - - /** - * The pattern string for which this filter should select - * elements in the viewer. - * - * @param patternString - */ - public void setPattern(String patternString) { - // these 2 strings allow the PatternFilter to be extended in - // 3.3 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=186404 - if ("org.eclipse.ui.keys.optimization.true".equals(patternString)) { //$NON-NLS-1$ - useEarlyReturnIfMatcherIsNull = true; - return; - } else if ("org.eclipse.ui.keys.optimization.false".equals(patternString)) { //$NON-NLS-1$ - useEarlyReturnIfMatcherIsNull = false; - return; - } - clearCaches(); - if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ - matcher = null; - } else { - String pattern = patternString + "*"; //$NON-NLS-1$ - if (includeLeadingWildcard) { - pattern = "*" + pattern; //$NON-NLS-1$ - } - matcher = new StringMatcher(pattern, true, false); - } - } - - /** - * Clears the caches used for optimizing this filter. Needs to be called whenever - * the tree content changes. - */ - /* package */ void clearCaches() { - cache.clear(); - foundAnyCache.clear(); - } - - /** - * Answers whether the given String matches the pattern. - * - * @param string the String to test - * - * @return whether the string matches the pattern - */ - private boolean match(String string) { - if (matcher == null) { - return true; - } - return matcher.match(string); - } - - /** - * Answers whether the given element is a valid selection in - * the filtered tree. For example, if a tree has items that - * are categorized, the category itself may not be a valid - * selection since it is used merely to organize the elements. - * - * @param element - * @return true if this element is eligible for automatic selection - */ - public boolean isElementSelectable(Object element){ - return element != null; - } - - /** - * Answers whether the given element in the given viewer matches - * the filter pattern. This is a default implementation that will - * show a leaf element in the tree based on whether the provided - * filter text matches the text of the given element's text, or that - * of it's children (if the element has any). - * - * Subclasses may override this method. - * - * @param viewer the tree viewer in which the element resides - * @param element the element in the tree to check for a match - * - * @return true if the element matches the filter pattern - */ - public boolean isElementVisible(Viewer viewer, Object element){ - return isParentMatch(viewer, element) || isLeafMatch(viewer, element); - } - - /** - * Check if the parent (category) is a match to the filter text. The default - * behavior returns true if the element has at least one child element that is - * a match with the filter text. - * - * Subclasses may override this method. - * - * @param viewer the viewer that contains the element - * @param element the tree element to check - * @return true if the given element has children that matches the filter text - */ - protected boolean isParentMatch(Viewer viewer, Object element){ - Object[] children = ((ITreeContentProvider) ((AbstractTreeViewer) viewer) - .getContentProvider()).getChildren(element); - - if ((children != null) && (children.length > 0)) { - return isAnyVisible(viewer, element, children); - } - return false; - } - - /** - * Check if the current (leaf) element is a match with the filter text. - * The default behavior checks that the label of the element is a match. - * - * Subclasses should override this method. - * - * @param viewer the viewer that contains the element - * @param element the tree element to check - * @return true if the given element's label matches the filter text - */ - protected boolean isLeafMatch(Viewer viewer, Object element){ - String labelText = ((ILabelProvider) ((StructuredViewer) viewer) - .getLabelProvider()).getText(element); - - if(labelText == null) { - return false; - } - return wordMatches(labelText); - } - - /** - * Take the given filter text and break it down into words using a - * BreakIterator. - * - * @param text - * @return an array of words - */ - private String[] getWords(String text){ - List<String> words = new ArrayList<String>(); - // Break the text up into words, separating based on whitespace and - // common punctuation. - // Previously used String.split(..., "\\W"), where "\W" is a regular - // expression (see the Javadoc for class Pattern). - // Need to avoid both String.split and regular expressions, in order to - // compile against JCL Foundation (bug 80053). - // Also need to do this in an NL-sensitive way. The use of BreakIterator - // was suggested in bug 90579. - BreakIterator iter = BreakIterator.getWordInstance(); - iter.setText(text); - int i = iter.first(); - while (i != java.text.BreakIterator.DONE && i < text.length()) { - int j = iter.following(i); - if (j == java.text.BreakIterator.DONE) { - j = text.length(); - } - // match the word - if (Character.isLetterOrDigit(text.charAt(i))) { - String word = text.substring(i, j); - words.add(word); - } - i = j; - } - return (String[]) words.toArray(new String[words.size()]); - } - - /** - * Return whether or not if any of the words in text satisfy the - * match critera. - * - * @param text the text to match - * @return boolean <code>true</code> if one of the words in text - * satisifes the match criteria. - */ - protected boolean wordMatches(String text) { - if (text == null) { - return false; - } - - //If the whole text matches we are all set - if(match(text)) { - return true; - } - - // Otherwise check if any of the words of the text matches - String[] words = getWords(text); - for (int i = 0; i < words.length; i++) { - String word = words[i]; - if (match(word)) { - return true; - } - } - - return false; - } - - /** - * Can be called by the filtered tree to turn on caching. - * - * @param useCache The useCache to set. - */ - void setUseCache(boolean useCache) { - this.useCache = useCache; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java deleted file mode 100644 index 8391c7a5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ShadowComposite.java +++ /dev/null @@ -1,659 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import javax.inject.Inject; -import javax.inject.Named; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CTabFolderRenderer; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.PaletteData; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.graphics.Region; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -public class ShadowComposite extends Composite { - - // ================================ - // Dummy to not modify code - // ================================ - public int marginWidth = 0; - public int marginHeight = 0; - - ShadowComposite parent; - - private int getTabHeight() { - return 0; - } - - private boolean getMinimized() { - return false; - } - - public static final int PART_BODY = -1; - public static final int PART_HEADER = -2; - public static final int PART_BORDER = -3; - public static final int PART_BACKGROUND = -4; - - // Constants for circle drawing - final static int LEFT_TOP = 0; - final static int LEFT_BOTTOM = 1; - final static int RIGHT_TOP = 2; - final static int RIGHT_BOTTOM = 3; - - // drop shadow constants - final static int SIDE_DROP_WIDTH = 3; - final static int BOTTOM_DROP_WIDTH = 4; - - // keylines - final static int OUTER_KEYLINE = 1; - final static int INNER_KEYLINE = 0; - final static int TOP_KEYLINE = 0; - - // Item Constants - static final int ITEM_TOP_MARGIN = 2; - static final int ITEM_BOTTOM_MARGIN = 6; - static final int ITEM_LEFT_MARGIN = 4; - static final int ITEM_RIGHT_MARGIN = 4; - static final int INTERNAL_SPACING = 4; - - static final String E4_SHADOW_IMAGE = "org.eclipse.e4.renderer.shadowcomposite_image"; //$NON-NLS-1$ - - static int[] shape; - - Image shadowImage; - - int cornerSize = 20; - - boolean shadowEnabled = true; - Color outerKeyline, innerKeyline; - Color[] activeToolbar; - int[] activePercents; - Color[] inactiveToolbar; - int[] inactivePercents; - boolean active; - - private boolean drawPolyline = true; - - public ShadowComposite(Composite parent, int style) { - super(parent, style); - this.parent = this; - this.outerKeyline = new Color(getDisplay(), new RGB(240, 240, 240)); - addListener(SWT.Paint, new Listener() { - - public void handleEvent(Event event) { - onPaint(event); - } - }); - addListener(SWT.Dispose, new Listener() { - - public void handleEvent(Event event) { - outerKeyline.dispose(); - } - }); - // addPaintListener(new PaintListener() { - // - // public void paintControl(PaintEvent e) { - // Point size = getSize(); - // Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); - // drawTabBody(e.gc, bodyRect, 0); - // drawTabHeader(e.gc, bodyRect, 0); - // } - // }); - } - - public Rectangle getClientArea() { - Rectangle trim = computeTrim(CTabFolderRenderer.PART_BODY, SWT.NONE, 0, 0, 0, 0); - // if (minimized) - // return new Rectangle(-trim.x, -trim.y, 0, 0); - Point size = getSize(); - int width = size.x - trim.width; - int height = size.y - trim.height; - return new Rectangle(-trim.x, -trim.y, width, height); - } - - private void onPaint(Event event) { - GC gc = event.gc; - gc.setAdvanced(true); - - Color gcBackground = gc.getBackground(); - Color gcForeground = gc.getForeground(); - - Point size = getSize(); - Rectangle bodyRect = new Rectangle(0, 0, size.x, size.y); - draw(CTabFolderRenderer.PART_BODY, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); - - gc.setForeground(gcForeground); - gc.setBackground(gcBackground); - - draw(CTabFolderRenderer.PART_HEADER, SWT.BACKGROUND | SWT.FOREGROUND, bodyRect, gc); - - } - - @Override - public Rectangle computeTrim(int x, int y, int width, int height) { - return computeTrim(PART_BODY, SWT.NONE, x, y, width, height); - } - - protected Rectangle computeTrim(int part, int state, int x, int y, int width, int height) { - GC gc = new GC(parent); - gc.dispose(); - int borderTop = TOP_KEYLINE + OUTER_KEYLINE; - int borderBottom = INNER_KEYLINE + OUTER_KEYLINE; - int marginWidth = parent.marginWidth; - int marginHeight = parent.marginHeight; - int sideDropWidth = shadowEnabled ? SIDE_DROP_WIDTH : 0; - switch (part) { - case PART_BODY: - x = x - marginWidth - OUTER_KEYLINE - INNER_KEYLINE - sideDropWidth - (cornerSize / 2); - width = width + 2 * OUTER_KEYLINE + 2 * INNER_KEYLINE + 2 * marginWidth + 2 * sideDropWidth + cornerSize; - int tabHeight = parent.getTabHeight() + 1; // TODO: Figure out what - // to do about the +1 - // TODO: Fix - if (parent.getMinimized()) { - y = /* parent.onBottom ? y - borderTop : */y - tabHeight - borderTop - 5; - height = borderTop + borderBottom + tabHeight; - } else { - // y = tabFolder.onBottom ? y - marginHeight - highlight_margin - // - borderTop: y - marginHeight - highlight_header - tabHeight - // - borderTop; - - y = y - marginHeight - tabHeight - borderTop - (cornerSize / 4); - height = height + borderBottom + borderTop + 2 * marginHeight + tabHeight + cornerSize / 2 + cornerSize / 4 + (shadowEnabled ? BOTTOM_DROP_WIDTH : 0); - } - break; - case PART_HEADER: - x = x - (INNER_KEYLINE + OUTER_KEYLINE) - sideDropWidth; - width = width + 2 * (INNER_KEYLINE + OUTER_KEYLINE + sideDropWidth); - break; - case PART_BORDER: - x = x - INNER_KEYLINE - OUTER_KEYLINE - sideDropWidth - (cornerSize / 4); - width = width + 2 * (INNER_KEYLINE + OUTER_KEYLINE + sideDropWidth) + cornerSize / 2; - y = y - borderTop; - height = height + borderTop + borderBottom; - break; - } - return new Rectangle(x, y, width, height); - } - - protected void draw(int part, int state, Rectangle bounds, GC gc) { - switch (part) { - case PART_BODY: - this.drawTabBody(gc, bounds, state); - return; - case PART_HEADER: - this.drawTabHeader(gc, bounds, state); - return; - } - } - - void drawTabHeader(GC gc, Rectangle bounds, int state) { - // gc.setClipping(bounds.x, bounds.y, bounds.width, - // parent.getTabHeight() + 1); - - int[] points = new int[1024]; - int index = 0; - int radius = cornerSize / 2; - int marginWidth = parent.marginWidth; - int marginHeight = parent.marginHeight; - int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * (shadowEnabled ? SIDE_DROP_WIDTH : 0) + 2 * marginWidth; - int width = bounds.width - delta; - int height = bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 * marginHeight - (shadowEnabled ? BOTTOM_DROP_WIDTH : 0); - int circX = bounds.x + delta / 2 + radius; - int circY = bounds.y + radius; - - // Fill in background - Region clipping = new Region(); - gc.getClipping(clipping); - Region region = new Region(); - region.add(shape); - region.intersect(clipping); - gc.setClipping(region); - - int header = 3; // TODO: this needs to be added to computeTrim for - // HEADER - Rectangle trim = computeTrim(PART_HEADER, state, 0, 0, 0, 0); - trim.width = bounds.width - trim.width; - trim.height = (parent.getTabHeight() + 1 + header) - trim.height; - trim.x = -trim.x; - trim.y = -trim.y; - - draw(PART_BACKGROUND, SWT.NONE, trim, gc); - - gc.setClipping(clipping); - clipping.dispose(); - region.dispose(); - - int[] ltt = drawCircle(circX + 1, circY + 1, radius, LEFT_TOP); - System.arraycopy(ltt, 0, points, index, ltt.length); - index += ltt.length; - - int[] lbb = drawCircle(circX + 1, circY + height - (radius * 2) - 2, radius, LEFT_BOTTOM); - System.arraycopy(lbb, 0, points, index, lbb.length); - index += lbb.length; - - int[] rb = drawCircle(circX + width - (radius * 2) - 2, circY + height - (radius * 2) - 2, radius, RIGHT_BOTTOM); - System.arraycopy(rb, 0, points, index, rb.length); - index += rb.length; - - int[] rt = drawCircle(circX + width - (radius * 2) - 2, circY + 1, radius, RIGHT_TOP); - System.arraycopy(rt, 0, points, index, rt.length); - index += rt.length; - points[index++] = points[0]; - points[index++] = points[1]; - - int[] tempPoints = new int[index]; - System.arraycopy(points, 0, tempPoints, 0, index); - - if (outerKeyline == null) - outerKeyline = gc.getDevice().getSystemColor(SWT.COLOR_BLACK); - - gc.setForeground(outerKeyline); - - if (drawPolyline) { - gc.drawPolyline(shape); - } - } - - void drawTabBody(GC gc, Rectangle bounds, int state) { - int[] points = new int[1024]; - int index = 0; - int radius = cornerSize / 2; - int marginWidth = parent.marginWidth; - int marginHeight = parent.marginHeight; - int delta = INNER_KEYLINE + OUTER_KEYLINE + 2 * (shadowEnabled ? SIDE_DROP_WIDTH : 0) + 2 * marginWidth; - int width = bounds.width - delta; - int height = Math.max(parent.getTabHeight() + INNER_KEYLINE + OUTER_KEYLINE + (shadowEnabled ? BOTTOM_DROP_WIDTH : 0), bounds.height - INNER_KEYLINE - OUTER_KEYLINE - 2 * marginHeight - (shadowEnabled ? BOTTOM_DROP_WIDTH : 0)); - - int circX = bounds.x + delta / 2 + radius; - int circY = bounds.y + radius; - - // Body - index = 0; - int[] ltt = drawCircle(circX, circY, radius, LEFT_TOP); - System.arraycopy(ltt, 0, points, index, ltt.length); - index += ltt.length; - - int[] lbb = drawCircle(circX, circY + height - (radius * 2), radius, LEFT_BOTTOM); - System.arraycopy(lbb, 0, points, index, lbb.length); - index += lbb.length; - - int[] rb = drawCircle(circX + width - (radius * 2), circY + height - (radius * 2), radius, RIGHT_BOTTOM); - System.arraycopy(rb, 0, points, index, rb.length); - index += rb.length; - - int[] rt = drawCircle(circX + width - (radius * 2), circY, radius, RIGHT_TOP); - System.arraycopy(rt, 0, points, index, rt.length); - index += rt.length; - points[index++] = circX; - points[index++] = circY - radius; - - int[] tempPoints = new int[index]; - System.arraycopy(points, 0, tempPoints, 0, index); - gc.fillPolygon(tempPoints); - - // Fill in parent background for non-rectangular shape - Region r = new Region(); - r.add(bounds); - r.subtract(tempPoints); - gc.setBackground(parent.getParent().getBackground()); - Display display = parent.getDisplay(); - Region clipping = new Region(); - gc.getClipping(clipping); - r.intersect(clipping); - gc.setClipping(r); - Rectangle mappedBounds = display.map(parent, parent.getParent(), bounds); - parent.getParent().drawBackground(gc, bounds.x, bounds.y, bounds.width, bounds.height, mappedBounds.x, mappedBounds.y); - - // Shadow - if (shadowEnabled) - drawShadow(display, bounds, gc); - - gc.setClipping(clipping); - clipping.dispose(); - r.dispose(); - - shape = tempPoints; - } - - static int[] drawCircle(int xC, int yC, int r, int circlePart) { - int x = 0, y = r, u = 1, v = 2 * r - 1, e = 0; - int[] points = new int[1024]; - int[] pointsMirror = new int[1024]; - int loop = 0; - int loopMirror = 0; - while (x < y) { - if (circlePart == RIGHT_BOTTOM) { - points[loop++] = xC + x; - points[loop++] = yC + y; - } - if (circlePart == RIGHT_TOP) { - points[loop++] = xC + y; - points[loop++] = yC - x; - } - if (circlePart == LEFT_TOP) { - points[loop++] = xC - x; - points[loop++] = yC - y; - } - if (circlePart == LEFT_BOTTOM) { - points[loop++] = xC - y; - points[loop++] = yC + x; - } - x++; - e += u; - u += 2; - if (v < 2 * e) { - y--; - e -= v; - v -= 2; - } - if (x > y) - break; - if (circlePart == RIGHT_BOTTOM) { - pointsMirror[loopMirror++] = xC + y; - pointsMirror[loopMirror++] = yC + x; - } - if (circlePart == RIGHT_TOP) { - pointsMirror[loopMirror++] = xC + x; - pointsMirror[loopMirror++] = yC - y; - } - if (circlePart == LEFT_TOP) { - pointsMirror[loopMirror++] = xC - y; - pointsMirror[loopMirror++] = yC - x; - } - if (circlePart == LEFT_BOTTOM) { - pointsMirror[loopMirror++] = xC - x; - pointsMirror[loopMirror++] = yC + y; - } - // grow? - if ((loop + 1) > points.length) { - int length = points.length * 2; - int[] newPointTable = new int[length]; - int[] newPointTableMirror = new int[length]; - System.arraycopy(points, 0, newPointTable, 0, points.length); - points = newPointTable; - System.arraycopy(pointsMirror, 0, newPointTableMirror, 0, pointsMirror.length); - pointsMirror = newPointTableMirror; - } - } - int[] finalArray = new int[loop + loopMirror]; - System.arraycopy(points, 0, finalArray, 0, loop); - for (int i = loopMirror - 1, j = loop; i > 0; i = i - 2, j = j + 2) { - int tempY = pointsMirror[i]; - int tempX = pointsMirror[i - 1]; - finalArray[j] = tempX; - finalArray[j + 1] = tempY; - } - return finalArray; - } - - void drawShadow(final Display display, Rectangle bounds, GC gc) { - if (shadowImage == null) - createShadow(display); - - int x = bounds.x; - int y = bounds.y; - int SIZE = shadowImage.getBounds().width / 3; - - int height = Math.max(bounds.height, SIZE * 2); - int width = Math.max(bounds.width, SIZE * 2); - // top left - gc.drawImage(shadowImage, 0, 0, SIZE, SIZE, 2, 10, SIZE, 20); - int fillHeight = height - SIZE * 2; - int fillWidth = width + 5 - SIZE * 2; - - int xFill = 0; - for (int i = SIZE; i < fillHeight; i += SIZE) { - xFill = i; - gc.drawImage(shadowImage, 0, SIZE, SIZE, SIZE, 2, i, SIZE, SIZE); - } - - // Pad the rest of the shadow - gc.drawImage(shadowImage, 0, SIZE, SIZE, fillHeight - xFill, 2, xFill + SIZE, SIZE, fillHeight - xFill); - - // bl - gc.drawImage(shadowImage, 0, 40, 20, 20, 2, y + height - SIZE, 20, 20); - - int yFill = 0; - for (int i = SIZE; i <= fillWidth; i += SIZE) { - yFill = i; - gc.drawImage(shadowImage, SIZE, SIZE * 2, SIZE, SIZE, i, y + height - SIZE, SIZE, SIZE); - } - // Pad the rest of the shadow - gc.drawImage(shadowImage, SIZE, SIZE * 2, fillWidth - yFill, SIZE, yFill + SIZE, y + height - SIZE, fillWidth - yFill, SIZE); - - // br - gc.drawImage(shadowImage, SIZE * 2, SIZE * 2, SIZE, SIZE, x + width - SIZE - 1, y + height - SIZE, SIZE, SIZE); - - // tr - gc.drawImage(shadowImage, (SIZE * 2), 0, SIZE, SIZE, x + width - SIZE - 1, 10, SIZE, SIZE); - - xFill = 0; - for (int i = SIZE; i < fillHeight; i += SIZE) { - xFill = i; - gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, SIZE, x + width - SIZE - 1, i, SIZE, SIZE); - } - - // Pad the rest of the shadow - gc.drawImage(shadowImage, SIZE * 2, SIZE, SIZE, fillHeight - xFill, x + width - SIZE - 1, xFill + SIZE, SIZE, fillHeight - xFill); - } - - void createShadow(final Display display) { - Object obj = display.getData(E4_SHADOW_IMAGE); - if (obj != null) { - shadowImage = (Image) obj; - } else { - ImageData data = new ImageData(60, 60, 32, new PaletteData(0xFF0000, 0xFF00, 0xFF)); - Image tmpImage = shadowImage = new Image(display, data); - GC gc = new GC(tmpImage); - Color shadowColor = new Color(display, new RGB(128, 128, 128)); - gc.setBackground(shadowColor); - drawTabBody(gc, new Rectangle(0, 0, 60, 60), SWT.None); - ImageData blured = blur(tmpImage, 5, 25); - shadowImage = new Image(display, blured); - display.setData(E4_SHADOW_IMAGE, shadowImage); - tmpImage.dispose(); - shadowColor.dispose(); - display.disposeExec(new Runnable() { - public void run() { - Object obj = display.getData(E4_SHADOW_IMAGE); - if (obj != null) { - Image tmp = (Image) obj; - tmp.dispose(); - display.setData(E4_SHADOW_IMAGE, null); - } - } - }); - } - } - - public ImageData blur(Image src, int radius, int sigma) { - float[] kernel = create1DKernel(radius, sigma); - - ImageData imgPixels = src.getImageData(); - int width = imgPixels.width; - int height = imgPixels.height; - - int[] inPixels = new int[width * height]; - int[] outPixels = new int[width * height]; - int offset = 0; - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - RGB rgb = imgPixels.palette.getRGB(imgPixels.getPixel(x, y)); - if (rgb.red == 255 && rgb.green == 255 && rgb.blue == 255) { - inPixels[offset] = (rgb.red << 16) | (rgb.green << 8) | rgb.blue; - } else { - inPixels[offset] = (imgPixels.getAlpha(x, y) << 24) | (rgb.red << 16) | (rgb.green << 8) | rgb.blue; - } - offset++; - } - } - - convolve(kernel, inPixels, outPixels, width, height, true); - convolve(kernel, outPixels, inPixels, height, width, true); - - ImageData dst = new ImageData(imgPixels.width, imgPixels.height, 24, new PaletteData(0xff0000, 0xff00, 0xff)); - - dst.setPixels(0, 0, inPixels.length, inPixels, 0); - offset = 0; - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - if (inPixels[offset] == -1) { - dst.setAlpha(x, y, 0); - } else { - int a = (inPixels[offset] >> 24) & 0xff; - // if (a < 150) a = 0; - dst.setAlpha(x, y, a); - } - offset++; - } - } - return dst; - } - - private void convolve(float[] kernel, int[] inPixels, int[] outPixels, int width, int height, boolean alpha) { - int kernelWidth = kernel.length; - int kernelMid = kernelWidth / 2; - for (int y = 0; y < height; y++) { - int index = y; - int currentLine = y * width; - for (int x = 0; x < width; x++) { - // do point - float a = 0, r = 0, g = 0, b = 0; - for (int k = -kernelMid; k <= kernelMid; k++) { - float val = kernel[k + kernelMid]; - int xcoord = x + k; - if (xcoord < 0) - xcoord = 0; - if (xcoord >= width) - xcoord = width - 1; - int pixel = inPixels[currentLine + xcoord]; - // float alp = ((pixel >> 24) & 0xff); - a += val * ((pixel >> 24) & 0xff); - r += val * (((pixel >> 16) & 0xff)); - g += val * (((pixel >> 8) & 0xff)); - b += val * (((pixel) & 0xff)); - } - int ia = alpha ? clamp((int) (a + 0.5)) : 0xff; - int ir = clamp((int) (r + 0.5)); - int ig = clamp((int) (g + 0.5)); - int ib = clamp((int) (b + 0.5)); - outPixels[index] = (ia << 24) | (ir << 16) | (ig << 8) | ib; - index += height; - } - } - - } - - private int clamp(int value) { - if (value > 255) - return 255; - if (value < 0) - return 0; - return value; - } - - private float[] create1DKernel(int radius, int sigma) { - // guideline: 3*sigma should be the radius - int size = radius * 2 + 1; - float[] kernel = new float[size]; - int radiusSquare = radius * radius; - float sigmaSquare = 2 * sigma * sigma; - float piSigma = 2 * (float) Math.PI * sigma; - float sqrtSigmaPi2 = (float) Math.sqrt(piSigma); - int start = size / 2; - int index = 0; - float total = 0; - for (int i = -start; i <= start; i++) { - float d = i * i; - if (d > radiusSquare) { - kernel[index] = 0; - } else { - kernel[index] = (float) Math.exp(-(d) / sigmaSquare) / sqrtSigmaPi2; - } - total += kernel[index]; - index++; - } - for (int i = 0; i < size; i++) { - kernel[i] /= total; - } - return kernel; - } - - @Inject - @Optional - public void setCornerRadius(@Named("radius") Integer radius) { - cornerSize = radius.intValue(); - parent.redraw(); - } - - @Inject - @Optional - public void setShadowVisible(@Named("shadowVisible") Boolean visible) { - this.shadowEnabled = visible.booleanValue(); - parent.redraw(); - } - - @Inject - @Optional - public void setOuterKeyline(@Named("outerKeyline") Color color) { - this.outerKeyline = color; - // TODO: HACK! Should be set based on pseudo-state. - // setActive(!(color.getRed() == 255 && color.getGreen() == 255 && - // color.getBlue() == 255)); - parent.redraw(); - } - - @Inject - @Optional - public void setInnerKeyline(@Named("innerKeyline") Color color) { - this.innerKeyline = color; - parent.redraw(); - } - - @Inject - @Optional - public void setActiveToolbarGradient(@Named("activeToolbarColors") Color[] color, @Named("activeToolbarPercents") int[] percents) { - activeToolbar = color; - activePercents = percents; - } - - @Inject - @Optional - public void setInactiveToolbarGradient(@Named("inactiveToolbarColors") Color[] color, @Named("inactiveToolbarPercents") int[] percents) { - inactiveToolbar = color; - inactivePercents = percents; - } - - // public void setActive(boolean active) { - // this.active = active; - // Control topRight = parent.getTopRight(); - // if (topRight != null) { - // if (active && toolbarActiveImage == null) - // createActiveToolbarImages(Display.getCurrent()); - // if (!active && toolbarInactiveImage == null) - // createInactiveToolbarImages(Display.getCurrent()); - // topRight.setBackgroundImage(active ? toolbarActiveImage : - // toolbarInactiveImage); - // parent.redraw(); - // } - // } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java deleted file mode 100644 index cfd87687..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/StringMatcher.java +++ /dev/null @@ -1,451 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal; - -import java.util.Vector; - -/** - * A string pattern matcher, suppporting "*" and "?" wildcards. - */ -public class StringMatcher { - protected String fPattern; - - protected int fLength; // pattern length - - protected boolean fIgnoreWildCards; - - protected boolean fIgnoreCase; - - protected boolean fHasLeadingStar; - - protected boolean fHasTrailingStar; - - protected String fSegments[]; //the given pattern is split into * separated segments - - /* boundary value beyond which we don't need to search in the text */ - protected int fBound = 0; - - protected static final char fSingleWildCard = '\u0000'; - - public static class Position { - int start; //inclusive - - int end; //exclusive - - public Position(int start, int end) { - this.start = start; - this.end = end; - } - - public int getStart() { - return start; - } - - public int getEnd() { - return end; - } - } - - /** - * StringMatcher constructor takes in a String object that is a simple - * pattern which may contain '*' for 0 and many characters and - * '?' for exactly one character. - * - * Literal '*' and '?' characters must be escaped in the pattern - * e.g., "\*" means literal "*", etc. - * - * Escaping any other character (including the escape character itself), - * just results in that character in the pattern. - * e.g., "\a" means "a" and "\\" means "\" - * - * If invoking the StringMatcher with string literals in Java, don't forget - * escape characters are represented by "\\". - * - * @param pattern the pattern to match text against - * @param ignoreCase if true, case is ignored - * @param ignoreWildCards if true, wild cards and their escape sequences are ignored - * (everything is taken literally). - */ - public StringMatcher(String pattern, boolean ignoreCase, - boolean ignoreWildCards) { - if (pattern == null) { - throw new IllegalArgumentException(); - } - fIgnoreCase = ignoreCase; - fIgnoreWildCards = ignoreWildCards; - fPattern = pattern; - fLength = pattern.length(); - - if (fIgnoreWildCards) { - parseNoWildCards(); - } else { - parseWildCards(); - } - } - - /** - * Find the first occurrence of the pattern between <code>start</code)(inclusive) - * and <code>end</code>(exclusive). - * @param text the String object to search in - * @param start the starting index of the search range, inclusive - * @param end the ending index of the search range, exclusive - * @return an <code>StringMatcher.Position</code> object that keeps the starting - * (inclusive) and ending positions (exclusive) of the first occurrence of the - * pattern in the specified range of the text; return null if not found or subtext - * is empty (start==end). A pair of zeros is returned if pattern is empty string - * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc" - * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned - */ - public StringMatcher.Position find(String text, int start, int end) { - if (text == null) { - throw new IllegalArgumentException(); - } - - int tlen = text.length(); - if (start < 0) { - start = 0; - } - if (end > tlen) { - end = tlen; - } - if (end < 0 || start >= end) { - return null; - } - if (fLength == 0) { - return new Position(start, start); - } - if (fIgnoreWildCards) { - int x = posIn(text, start, end); - if (x < 0) { - return null; - } - return new Position(x, x + fLength); - } - - int segCount = fSegments.length; - if (segCount == 0) { - return new Position(start, end); - } - - int curPos = start; - int matchStart = -1; - int i; - for (i = 0; i < segCount && curPos < end; ++i) { - String current = fSegments[i]; - int nextMatch = regExpPosIn(text, curPos, end, current); - if (nextMatch < 0) { - return null; - } - if (i == 0) { - matchStart = nextMatch; - } - curPos = nextMatch + current.length(); - } - if (i < segCount) { - return null; - } - return new Position(matchStart, curPos); - } - - /** - * match the given <code>text</code> with the pattern - * @return true if matched otherwise false - * @param text a String object - */ - public boolean match(String text) { - if(text == null) { - return false; - } - return match(text, 0, text.length()); - } - - /** - * Given the starting (inclusive) and the ending (exclusive) positions in the - * <code>text</code>, determine if the given substring matches with aPattern - * @return true if the specified portion of the text matches the pattern - * @param text a String object that contains the substring to match - * @param start marks the starting position (inclusive) of the substring - * @param end marks the ending index (exclusive) of the substring - */ - public boolean match(String text, int start, int end) { - if (null == text) { - throw new IllegalArgumentException(); - } - - if (start > end) { - return false; - } - - if (fIgnoreWildCards) { - return (end - start == fLength) - && fPattern.regionMatches(fIgnoreCase, 0, text, start, - fLength); - } - int segCount = fSegments.length; - if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) { - return true; - } - if (start == end) { - return fLength == 0; - } - if (fLength == 0) { - return start == end; - } - - int tlen = text.length(); - if (start < 0) { - start = 0; - } - if (end > tlen) { - end = tlen; - } - - int tCurPos = start; - int bound = end - fBound; - if (bound < 0) { - return false; - } - int i = 0; - String current = fSegments[i]; - int segLength = current.length(); - - /* process first segment */ - if (!fHasLeadingStar) { - if (!regExpRegionMatches(text, start, current, 0, segLength)) { - return false; - } else { - ++i; - tCurPos = tCurPos + segLength; - } - } - if ((fSegments.length == 1) && (!fHasLeadingStar) - && (!fHasTrailingStar)) { - // only one segment to match, no wildcards specified - return tCurPos == end; - } - /* process middle segments */ - while (i < segCount) { - current = fSegments[i]; - int currentMatch; - int k = current.indexOf(fSingleWildCard); - if (k < 0) { - currentMatch = textPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { - return false; - } - } else { - currentMatch = regExpPosIn(text, tCurPos, end, current); - if (currentMatch < 0) { - return false; - } - } - tCurPos = currentMatch + current.length(); - i++; - } - - /* process final segment */ - if (!fHasTrailingStar && tCurPos != end) { - int clen = current.length(); - return regExpRegionMatches(text, end - clen, current, 0, clen); - } - return i == segCount; - } - - /** - * This method parses the given pattern into segments seperated by wildcard '*' characters. - * Since wildcards are not being used in this case, the pattern consists of a single segment. - */ - private void parseNoWildCards() { - fSegments = new String[1]; - fSegments[0] = fPattern; - fBound = fLength; - } - - /** - * Parses the given pattern into segments seperated by wildcard '*' characters. - * @param p, a String object that is a simple regular expression with '*' and/or '?' - */ - private void parseWildCards() { - if (fPattern.startsWith("*")) { //$NON-NLS-1$ - fHasLeadingStar = true; - } - if (fPattern.endsWith("*")) {//$NON-NLS-1$ - /* make sure it's not an escaped wildcard */ - if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') { - fHasTrailingStar = true; - } - } - - Vector<String> temp = new Vector<String>(); - - int pos = 0; - StringBuffer buf = new StringBuffer(); - while (pos < fLength) { - char c = fPattern.charAt(pos++); - switch (c) { - case '\\': - if (pos >= fLength) { - buf.append(c); - } else { - char next = fPattern.charAt(pos++); - /* if it's an escape sequence */ - if (next == '*' || next == '?' || next == '\\') { - buf.append(next); - } else { - /* not an escape sequence, just insert literally */ - buf.append(c); - buf.append(next); - } - } - break; - case '*': - if (buf.length() > 0) { - /* new segment */ - temp.addElement(buf.toString()); - fBound += buf.length(); - buf.setLength(0); - } - break; - case '?': - /* append special character representing single match wildcard */ - buf.append(fSingleWildCard); - break; - default: - buf.append(c); - } - } - - /* add last buffer to segment list */ - if (buf.length() > 0) { - temp.addElement(buf.toString()); - fBound += buf.length(); - } - - fSegments = new String[temp.size()]; - temp.copyInto(fSegments); - } - - /** - * @param text a string which contains no wildcard - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int posIn(String text, int start, int end) {//no wild card in pattern - int max = end - fLength; - - if (!fIgnoreCase) { - int i = text.indexOf(fPattern, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, fPattern, 0, fLength)) { - return i; - } - } - - return -1; - } - - /** - * @param text a simple regular expression that may only contain '?'(s) - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @param p a simple regular expression that may contains '?' - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int regExpPosIn(String text, int start, int end, String p) { - int plen = p.length(); - - int max = end - plen; - for (int i = start; i <= max; ++i) { - if (regExpRegionMatches(text, i, p, 0, plen)) { - return i; - } - } - return -1; - } - - /** - * - * @return boolean - * @param text a String to match - * @param start int that indicates the starting index of match, inclusive - * @param end</code> int that indicates the ending index of match, exclusive - * @param p String, String, a simple regular expression that may contain '?' - * @param ignoreCase boolean indicating wether code>p</code> is case sensitive - */ - protected boolean regExpRegionMatches(String text, int tStart, String p, - int pStart, int plen) { - while (plen-- > 0) { - char tchar = text.charAt(tStart++); - char pchar = p.charAt(pStart++); - - /* process wild cards */ - if (!fIgnoreWildCards) { - /* skip single wild cards */ - if (pchar == fSingleWildCard) { - continue; - } - } - if (pchar == tchar) { - continue; - } - if (fIgnoreCase) { - if (Character.toUpperCase(tchar) == Character - .toUpperCase(pchar)) { - continue; - } - // comparing after converting to upper case doesn't handle all cases; - // also compare after converting to lower case - if (Character.toLowerCase(tchar) == Character - .toLowerCase(pchar)) { - continue; - } - } - return false; - } - return true; - } - - /** - * @param text the string to match - * @param start the starting index in the text for search, inclusive - * @param end the stopping point of search, exclusive - * @param p a pattern string that has no wildcard - * @return the starting index in the text of the pattern , or -1 if not found - */ - protected int textPosIn(String text, int start, int end, String p) { - - int plen = p.length(); - int max = end - plen; - - if (!fIgnoreCase) { - int i = text.indexOf(p, start); - if (i == -1 || i > max) { - return -1; - } - return i; - } - - for (int i = start; i <= max; ++i) { - if (text.regionMatches(true, i, p, 0, plen)) { - return i; - } - } - - return -1; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java deleted file mode 100644 index b642e955..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ClassContributionCollector.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - - -import java.util.concurrent.CopyOnWriteArrayList; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; - -public class ClassContributionCollector { - private CopyOnWriteArrayList<IClassContributionProvider> providers = new CopyOnWriteArrayList<IClassContributionProvider>(); - - public void addContributor(IClassContributionProvider contributor) { - providers.add(contributor); - } - - public void removeContributor(IClassContributionProvider contributor) { - providers.remove(contributor); - } - - public void findContributions(Filter filter, ContributionResultHandler resultHandler) { - - for( IClassContributionProvider contributor: providers ) { - contributor.findContribution(filter, resultHandler); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java deleted file mode 100644 index 1ee61633..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ComponentLabelProvider.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.graphics.Image; - -public class ComponentLabelProvider extends StyledCellLabelProvider { - private Image modelComponentsImage; - private Image modelComonentImage; - private Image partsImage; - private Image menusImage; - private Image partImage; - private Image partDescriptorImage; - - private ModelEditor editor; - - public ComponentLabelProvider(ModelEditor editor) { - this.editor = editor; - } - - @Override - public void update(final ViewerCell cell) { - if( cell.getElement() instanceof EObject ) { - - EObject o = (EObject) cell.getElement(); - AbstractComponentEditor elementEditor = editor.getEditor(o.eClass()); - if( elementEditor != null ) { - String label = elementEditor.getLabel(o); - String detailText = elementEditor.getDetailLabel(o); - if( detailText == null ) { - cell.setText(label); - } else { - StyledString styledString = new StyledString(label, null); - styledString.append(" - " + detailText, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - cell.setImage(elementEditor.getImage(o, cell.getControl().getDisplay())); - } else { - cell.setText(cell.getElement().toString()); - } - } else if( cell.getElement() instanceof VirtualEntry<?> ) { - String s = cell.getElement().toString(); - cell.setText(s); - } else { - cell.setText(cell.getElement().toString()); - } - } - - @Override - public void dispose() { - if( modelComponentsImage != null ) { - modelComponentsImage.dispose(); - modelComponentsImage = null; - } - - if( modelComonentImage != null ) { - modelComonentImage.dispose(); - modelComonentImage = null; - } - - if( partsImage != null ) { - partsImage.dispose(); - partsImage = null; - } - - if( menusImage != null ) { - menusImage.dispose(); - menusImage = null; - } - - if( partImage != null ) { - partImage.dispose(); - partImage = null; - } - - if( partDescriptorImage != null ) { - partDescriptorImage.dispose(); - partDescriptorImage = null; - } - super.dispose(); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java deleted file mode 100644 index 23b38b7d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ /dev/null @@ -1,610 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; - -import org.eclipse.swt.widgets.TreeItem; - -import javax.annotation.PostConstruct; - -import org.eclipse.e4.ui.internal.workbench.E4XMIResource; - -import org.eclipse.e4.ui.model.application.ui.basic.MPart; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.PreDestroy; -import javax.inject.Inject; -import org.eclipse.core.databinding.observable.IObservable; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.map.IMapChangeListener; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.map.MapChangeEvent; -import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; -import org.eclipse.core.databinding.observable.set.ISetChangeListener; -import org.eclipse.core.databinding.observable.set.SetChangeEvent; -import org.eclipse.core.databinding.observable.set.WritableSet; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.RegistryFactory; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.core.services.contributions.IContributionFactory; -import org.eclipse.e4.tools.emf.ui.common.IEditorDescriptor; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.ISelectionProviderService; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ShadowComposite; -import org.eclipse.e4.tools.emf.ui.internal.common.component.AddonsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ApplicationEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.BindingTableEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.CommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.DirectToolItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledMenuItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandledToolItemEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.HandlerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.InputPartEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.KeyBindingEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.MenuSeparatorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ModelFragmentsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartDescriptorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartSashContainerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PartStackEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PerspectiveStackEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.PlaceholderEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.StringModelFragment; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolBarSeparatorEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.ToolControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimBarEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimContributionEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.TrimmedWindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.WindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VApplicationAddons; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VBindingTableEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VCommandEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VHandlerEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VMenuEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelFragmentsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VModelImportsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VPartDescriptor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VToolBarContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VTrimContributionsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowControlEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowSharedElementsEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.virtual.VWindowTrimEditor; -import org.eclipse.e4.ui.di.Focus; -import org.eclipse.e4.ui.di.Persist; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.e4.ui.model.fragment.MModelFragments; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; -import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; - -public class ModelEditor { - private static final String CSS_CLASS_KEY = "org.eclipse.e4.ui.css.CssClassName"; //$NON-NLS-1$ - - public static final String VIRTUAL_PART_MENU = ModelEditor.class.getName() + ".VIRTUAL_PART_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$ - public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$ - public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOWS"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$ - public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$ - public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$ - public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$ - public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$ - public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_TRIM_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TRIM_CONTRIBUTIONS"; //$NON-NLS-1$ - public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$ - public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$ - - private Map<EClass, AbstractComponentEditor> editorMap = new HashMap<EClass, AbstractComponentEditor>(); - private Map<String, AbstractComponentEditor> virtualEditors = new HashMap<String, AbstractComponentEditor>(); - private List<FeaturePath> labelFeaturePaths = new ArrayList<FeaturePath>(); - private List<IEditorFeature> editorFeatures = new ArrayList<IEditorFeature>(); - - // private List<AbstractComponentEditor> editors = new - // ArrayList<AbstractComponentEditor>(); - - private TreeViewer viewer; - private IModelResource modelProvider; - private IProject project; - private ISelectionProviderService selectionService; - private IEclipseContext context; - private boolean fragment; - - @Inject - @Optional - private MPart editorPart; - - public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project) { - this.modelProvider = modelProvider; - this.project = project; - this.context = context; - this.context.set(ModelEditor.class, this); - - registerDefaultEditors(); - registerVirtualEditors(); - - registerContributedEditors(); - registerContributedVirtualEditors(); - loadEditorFeatures(); - - fragment = modelProvider.getRoot().get(0) instanceof MModelFragments; - - SashForm form = new SashForm(composite, SWT.HORIZONTAL); - form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - - viewer = createTreeViewerArea(form); - - Composite parent = new Composite(form, SWT.NONE); - parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - parent.setBackgroundMode(SWT.INHERIT_DEFAULT); - // parent.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); - FillLayout l = new FillLayout(); - l.marginWidth = 5; - parent.setLayout(l); - - ShadowComposite editingArea = new ShadowComposite(parent, SWT.NONE); - GridLayout gl = new GridLayout(); - gl.marginTop = 0; - gl.marginHeight = 0; - editingArea.setLayout(gl); - editingArea.setBackgroundMode(SWT.INHERIT_DEFAULT); - // editingArea.setData("org.eclipse.e4.ui.css.CssClassName","contentContainer"); - - Composite headerContainer = new Composite(editingArea, SWT.NONE); - headerContainer.setBackgroundMode(SWT.INHERIT_DEFAULT); - headerContainer.setData(CSS_CLASS_KEY, "headerSectionContainer"); //$NON-NLS-1$ - headerContainer.setLayout(new GridLayout(3, false)); - headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final Label iconLabel = new Label(headerContainer, SWT.NONE); - iconLabel.setLayoutData(new GridData(20, 20)); - - final Label textLabel = new Label(headerContainer, SWT.NONE); - textLabel.setData(CSS_CLASS_KEY, "sectionHeader"); //$NON-NLS-1$ - textLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - final ScrolledComposite scrolling = new ScrolledComposite(editingArea, SWT.H_SCROLL | SWT.V_SCROLL); - scrolling.setBackgroundMode(SWT.INHERIT_DEFAULT); - scrolling.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - - final EStackLayout layout = new EStackLayout(); - final Composite contentContainer = new Composite(scrolling, SWT.NONE); - contentContainer.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - scrolling.setExpandHorizontal(true); - scrolling.setExpandVertical(true); - scrolling.setContent(contentContainer); - - scrolling.addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - } - }); - - scrolling.setLayoutData(new GridData(GridData.FILL_BOTH)); - contentContainer.setLayout(layout); - - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - - public void selectionChanged(SelectionChangedEvent event) { - if (!event.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) event.getSelection(); - if (s.getFirstElement() instanceof EObject) { - EObject obj = (EObject) s.getFirstElement(); - AbstractComponentEditor editor = getEditor(obj.eClass()); - if (editor != null) { - textLabel.setText(editor.getLabel(obj)); - iconLabel.setImage(editor.getImage(obj, iconLabel.getDisplay())); - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); - } - } else { - VirtualEntry<?> entry = (VirtualEntry<?>) s.getFirstElement(); - AbstractComponentEditor editor = virtualEditors.get(entry.getId()); - if (editor != null) { - textLabel.setText(editor.getLabel(entry)); - iconLabel.setImage(editor.getImage(entry, iconLabel.getDisplay())); - Composite comp = editor.getEditor(contentContainer, s.getFirstElement()); - comp.setBackgroundMode(SWT.INHERIT_DEFAULT); - layout.topControl = comp; - contentContainer.layout(true); - } - } - - Rectangle r = scrolling.getClientArea(); - scrolling.setMinSize(contentContainer.computeSize(r.width, SWT.DEFAULT)); - scrolling.setOrigin(0, 0); - scrolling.layout(true,true); - - if (selectionService != null) { - selectionService.setSelection(s.getFirstElement()); - } - - } - } - }); - - form.setWeights(new int[] { 1, 2 }); - viewer.setSelection(new StructuredSelection(modelProvider.getRoot())); - - MenuManager mgr = new MenuManager(); - mgr.setRemoveAllWhenShown(true); - mgr.addMenuListener(new IMenuListener() { - - public void menuAboutToShow(IMenuManager manager) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (!s.isEmpty()) { - List<Action> actions; - if (s.getFirstElement() instanceof VirtualEntry<?>) { - actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActions(s.getFirstElement()); - } else { - EObject o = (EObject) s.getFirstElement(); - AbstractComponentEditor editor = getEditor(o.eClass()); - if (editor != null) { - actions = editor.getActions(s.getFirstElement()); - } else { - actions = Collections.emptyList(); - } - } - - for (Action a : actions) { - manager.add(a); - } - } - } - }); - viewer.getControl().setMenu(mgr.createContextMenu(viewer.getControl())); - } - - private void loadEditorFeatures() { - IExtensionRegistry registry = RegistryFactory.getRegistry(); - IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editorfeature".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - editorFeatures.add((IEditorFeature) el.createExecutableExtension("class")); //$NON-NLS-1$ - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - public boolean isModelFragment() { - return fragment; - } - - public boolean isLiveModel() { - return ! modelProvider.isSaveable(); - } - - public List<FeatureClass> getFeatureClasses(EClass eClass, EStructuralFeature feature) { - List<FeatureClass> list = new ArrayList<IEditorFeature.FeatureClass>(); - - for( IEditorFeature f : editorFeatures ) { - list.addAll(f.getFeatureClasses(eClass, feature)); - } - - return list; - } - - @Inject - public void setSelectionService(@Optional ISelectionProviderService selectionService) { - this.selectionService = selectionService; - if (viewer != null && !viewer.getControl().isDisposed()) { - if (!viewer.getSelection().isEmpty() && selectionService != null) { - selectionService.setSelection(((IStructuredSelection) viewer.getSelection()).getFirstElement()); - } - } - } - - // @Inject - // public void updateSelection(@Optional @Named(IServiceConstants.SELECTION) - // Object selection ) { - // System.err.println("The selection: " + selection); - // } - - private TreeViewer createTreeViewerArea(Composite parent) { - parent = new Composite(parent, SWT.NONE); - parent.setData(CSS_CLASS_KEY, "formContainer"); //$NON-NLS-1$ - parent.setBackgroundMode(SWT.INHERIT_DEFAULT); - - FillLayout l = new FillLayout(); - l.marginWidth = 5; - parent.setLayout(l); - ShadowComposite editingArea = new ShadowComposite(parent, SWT.NONE); - editingArea.setLayout(new FillLayout()); - final TreeViewer viewer = new TreeViewer(editingArea, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setLabelProvider(new ComponentLabelProvider(this)); - ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); - viewer.setContentProvider(contentProvider); - - final WritableSet clearedSet = new WritableSet(); - - contentProvider.getKnownElements().addSetChangeListener(new ISetChangeListener() { - - public void handleSetChange(SetChangeEvent event) { - for (Object o : event.diff.getAdditions()) { - if (o instanceof EObject) { - clearedSet.add(o); - } - } - - for (Object o : event.diff.getRemovals()) { - if (o instanceof EObject) { - clearedSet.remove(o); - } - } - } - }); - - for (FeaturePath p : labelFeaturePaths) { - IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet); - map.addMapChangeListener(new IMapChangeListener() { - - public void handleMapChange(MapChangeEvent event) { - viewer.update(event.diff.getChangedKeys().toArray(), null); - } - }); - } - - viewer.setInput(modelProvider.getRoot()); - viewer.expandToLevel(2); - - return viewer; - } - - private void registerContributedVirtualEditors() { - IExtensionRegistry registry = RegistryFactory.getRegistry(); - IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"virtualeditor".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$ - } - } - - private void registerVirtualEditors() { - registerVirtualEditor(VIRTUAL_PART_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, BasicPackageImpl.Literals.PART__MENUS)); - registerVirtualEditor(VIRTUAL_HANDLER, new VHandlerEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_BINDING_TABLE, new VBindingTableEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_COMMAND, new VCommandEditor(modelProvider.getEditingDomain(), this, ApplicationPackageImpl.Literals.APPLICATION__COMMANDS)); - registerVirtualEditor(VIRTUAL_WINDOWS, new VWindowEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, new VWindowControlEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, new VPartDescriptor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, new VMenuEditor(modelProvider.getEditingDomain(), this, org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS)); - registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, new VWindowTrimEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_ADDONS, new VApplicationAddons(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, new VMenuContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, new VToolBarContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, new VTrimContributionsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, new VWindowSharedElementsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, new VModelFragmentsEditor(modelProvider.getEditingDomain(), this)); - registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, new VModelImportsEditor(modelProvider.getEditingDomain(), this)); - - } - - private void registerVirtualEditor(String id, AbstractComponentEditor editor) { - virtualEditors.put(id, editor); - } - - public void setSelection(Object element) { - viewer.setSelection(new StructuredSelection(element)); - } - - private void registerContributedEditors() { - IExtensionRegistry registry = RegistryFactory.getRegistry(); - IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$ - - for (IConfigurationElement el : extPoint.getConfigurationElements()) { - if (!"editor".equals(el.getName())) { //$NON-NLS-1$ - continue; - } - - try { - IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$ - EClass eClass = desc.getEClass(); - IContributionFactory fact = context.get(IContributionFactory.class); - AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("platform:/plugin/" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$ - registerEditor(eClass, editor); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - private void registerDefaultEditors() { - registerEditor(ApplicationPackageImpl.Literals.APPLICATION, new ApplicationEditor(modelProvider.getEditingDomain(),this)); - registerEditor(ApplicationPackageImpl.Literals.ADDON, new AddonsEditor(modelProvider.getEditingDomain(),this, project)); - - registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, new KeyBindingEditor(modelProvider.getEditingDomain(),this, modelProvider)); - registerEditor(CommandsPackageImpl.Literals.HANDLER, new HandlerEditor(modelProvider.getEditingDomain(),this, modelProvider, project)); - registerEditor(CommandsPackageImpl.Literals.COMMAND, new CommandEditor(modelProvider.getEditingDomain(),this)); - registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, new BindingTableEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(MenuPackageImpl.Literals.TOOL_BAR, new ToolBarEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, new DirectToolItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, new HandledToolItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, new ToolBarSeparatorEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, new ToolControlEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(MenuPackageImpl.Literals.MENU, new MenuEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, new MenuSeparatorEditor(modelProvider.getEditingDomain(), this)); - registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, new HandledMenuItemEditor(modelProvider.getEditingDomain(), this, project, modelProvider)); - registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, new DirectMenuItemEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, new MenuContributionEditor(modelProvider.getEditingDomain(),project, this)); - registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, new ToolBarContributionEditor(modelProvider.getEditingDomain(),project, this)); - registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, new TrimContributionEditor(modelProvider.getEditingDomain(),project, this)); - - - registerEditor(BasicPackageImpl.Literals.PART, new PartEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.WINDOW, new WindowEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, new TrimmedWindowEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, new PartSashContainerEditor(modelProvider.getEditingDomain(), this)); - registerEditor(BasicPackageImpl.Literals.PART_STACK, new PartStackEditor(modelProvider.getEditingDomain(), this)); - registerEditor(BasicPackageImpl.Literals.INPUT_PART, new InputPartEditor(modelProvider.getEditingDomain(), this, project)); - registerEditor(BasicPackageImpl.Literals.TRIM_BAR, new TrimBarEditor(modelProvider.getEditingDomain(), this)); - - registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, new PartDescriptorEditor(modelProvider.getEditingDomain(), this, project)); - - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, new PerspectiveStackEditor(modelProvider.getEditingDomain(), this)); - registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, new PerspectiveEditor(modelProvider.getEditingDomain(), project, this)); - registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, new PlaceholderEditor(modelProvider.getEditingDomain(),this,modelProvider)); - - registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, new ModelFragmentsEditor(modelProvider.getEditingDomain(), this)); - registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, new StringModelFragment(modelProvider.getEditingDomain(),this)); - } - - public void registerEditor(EClass eClass, AbstractComponentEditor editor) { - editorMap.put(eClass, editor); - - for (FeaturePath p : editor.getLabelProperties()) { - boolean found = false; - for (FeaturePath tmp : labelFeaturePaths) { - if (equalsPaths(p, tmp)) { - found = true; - break; - } - } - - if (!found) { - labelFeaturePaths.add(p); - } - } - } - - private boolean equalsPaths(FeaturePath p1, FeaturePath p2) { - if (p1.getFeaturePath().length == p2.getFeaturePath().length) { - for (int i = 0; i < p1.getFeaturePath().length; i++) { - if (!p1.getFeaturePath()[i].equals(p2.getFeaturePath()[i])) { - return false; - } - } - - return true; - } - - return false; - } - - public AbstractComponentEditor getEditor(EClass eClass) { - AbstractComponentEditor editor = editorMap.get(eClass); - if( editor == null ) { - for( EClass cl : eClass.getESuperTypes() ) { - editor = getEditor(cl); - if( editor != null ) { - return editor; - } - } - } - return editor; - } - - @Persist - public void doSave(@Optional IProgressMonitor monitor) { - if (modelProvider.isSaveable()) { - modelProvider.save(); - } - } - - @Focus - public void setFocus() { - viewer.getControl().setFocus(); - } - - private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { - - } - - private class ObservableFactoryImpl implements IObservableFactory { - - public IObservable createObservable(Object target) { - if (target instanceof IObservableList) { - return (IObservable) target; - } else if (target instanceof VirtualEntry<?>) { - return ((VirtualEntry<?>) target).getList(); - } else { - AbstractComponentEditor editor = getEditor(((EObject) target).eClass()); - if (editor != null) { - return editor.getChildList(target); - } - } - - return null; - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java deleted file mode 100644 index 84d6af1a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/VirtualEntry.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common; - -import org.eclipse.core.databinding.observable.DisposeEvent; -import org.eclipse.core.databinding.observable.IDisposeListener; - -import org.eclipse.core.databinding.observable.DisposeEvent; -import org.eclipse.core.databinding.observable.IDisposeListener; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.Diffs; -import org.eclipse.core.databinding.observable.list.IListChangeListener; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.ListChangeEvent; -import org.eclipse.core.databinding.observable.list.ListDiff; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; - -public abstract class VirtualEntry<M> { - private String id; - private Object originalParent; - private String label; - private IObservableList list; - - public VirtualEntry(String id, IListProperty property, Object originalParent, String label) { - this.id = id; - this.originalParent = originalParent; - this.label = label; - this.list = new WritableList(); - final IObservableList origList = property.observe(originalParent); - list.addAll(cleanedList(origList)); - - final IListChangeListener listener = new IListChangeListener() { - - public void handleListChange(ListChangeEvent event) { - if( ! VirtualEntry.this.list.isDisposed() ) { - List<Object> clean = cleanedList(event.getObservableList()); - ListDiff diff = Diffs.computeListDiff(VirtualEntry.this.list, clean); - diff.applyTo(VirtualEntry.this.list); - } - } - }; - - origList.addListChangeListener(listener); - } - - @SuppressWarnings("unchecked") - private List<Object> cleanedList(IObservableList list) { - List<Object> l = new ArrayList<Object>(list.size()); - - for( Object o : list ) { - if( accepted((M) o) ) { - l.add(o); - } - } - - return l; - } - - protected abstract boolean accepted(M o); - - public IObservableList getList() { - return list; - } - - public Object getOriginalParent() { - return originalParent; - } - - public String getId() { - return id; - } - - @Override - public String toString() { - return label; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java deleted file mode 100644 index 27cf0d51..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/AddAddonCommand.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationFactory; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class AddAddonCommand { - public void execute(EditingDomain editingDomain, MApplication parent) { - MAddon command = MApplicationFactory.INSTANCE.createAddon(); - Command cmd = AddCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, command); - - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java deleted file mode 100644 index 6c3f9889..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/MoveAddonCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class MoveAddonCommand { - public void execute(EditingDomain editingDomain, MAddon addon, boolean up) { - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java deleted file mode 100644 index fed166ce..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/commands/RemoveAddonCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.commands; - -import java.util.List; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class RemoveAddonCommand { - public void execute(EditingDomain editingDomain, List<MAddon> addons) { - EObject parent = ((EObject)addons.get(0)).eContainer(); - for( MAddon a : addons ) { - if( parent != ((EObject)a).eContainer() ) { - throw new IllegalArgumentException("The addons all have to belong to the same parent container"); - } - } - Command cmd = RemoveCommand.create(editingDomain, parent, ApplicationPackageImpl.Literals.APPLICATION__ADDONS, addons); - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java deleted file mode 100644 index 9b75c4e5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class AddonsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private IProject project; - private Image image; - private EStackLayout stackLayout; - - public AddonsEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if( image == null ) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Addon"; - } - - @Override - public String getDetailLabel(Object element) { - MContribution contrib = (MContribution) element; - if( contrib.getContributionURI() != null && contrib.getContributionURI().trim().length() > 0 ) { - return contrib.getContributionURI().substring(contrib.getContributionURI().lastIndexOf('/')+1); - } - return null; - } - - @Override - public String getDescription(Object element) { - return "Addon Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if( getEditor().isModelFragment() ) { - Control topControl; - if( Util.isImport((EObject) object) ) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if( stackLayout.topControl != topControl ) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - - if( getEditor().isModelFragment() && isImport ) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AddonsEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.AddonsEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.AddonsEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - -// ControlFactory.createBindingsWidget(parent, this); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java deleted file mode 100644 index c2bed1d2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ApplicationEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty BINDING_CONTAINER__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES); - private IListProperty APPLICATION__COMMANDS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__COMMANDS); - private IListProperty PART_DESCRIPTOR_CONTAINER__DESCRIPTORS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS); - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private IListProperty APPLICATION__ADDONS = EMFProperties.list(ApplicationPackageImpl.Literals.APPLICATION__ADDONS); - private IListProperty MENU_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS); - private IListProperty TOOLBAR_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS); - private IListProperty TRIM_CONTRIBUTIONS = EMFProperties.list(MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS); - - public ApplicationEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Application.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.ApplicationEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ApplicationEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context); - } - getMaster().setValue(object); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ApplicationEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_ADDONS, APPLICATION__ADDONS, element, Messages.ApplicationEditor_Addons) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.ApplicationEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_DESCRIPTORS, PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, element, Messages.ApplicationEditor_PartDescriptors) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_BINDING_TABLE, BINDING_CONTAINER__BINDINGS, element, Messages.ApplicationEditor_BindingTables) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_COMMAND, APPLICATION__COMMANDS, element, Messages.ApplicationEditor_Commands) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOWS, ELEMENT_CONTAINER__CHILDREN, element, Messages.ApplicationEditor_Windows) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MENU_CONTRIBUTIONS, MENU_CONTRIBUTIONS, element, Messages.ApplicationEditor_MenuContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_TOOLBAR_CONTRIBUTIONS, TOOLBAR_CONTRIBUTIONS, element, Messages.ApplicationEditor_ToolBarContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_TRIM_CONTRIBUTIONS, TRIM_CONTRIBUTIONS, element, Messages.ApplicationEditor_TrimContributions) { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java deleted file mode 100644 index 53f4c330..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java +++ /dev/null @@ -1,336 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class BindingTableEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty BINDING_TABLE__BINDINGS = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); - private EStackLayout stackLayout; - - public BindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.BindingTableEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.BindingTableEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_ContextId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID).observeDetail(getMaster())); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.BindingTableEditor_Find); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.BindingTableEditor_Keybindings); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_KeySequence); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_Command); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.BindingTableEditor_Id); - column.getColumn().setWidth(170); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindingTable container = (MBindingTable) getMaster().getValue(); - int idx = container.getBindings().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindingTable container = (MBindingTable) getMaster().getValue(); - int idx = container.getBindings().indexOf(obj) + 1; - if (idx < container.getBindings().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MKeyBinding handler = MCommandsFactory.INSTANCE.createKeyBinding(); - System.err.println(getMaster().getValue()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.BindingTableEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE__BINDINGS, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return BINDING_TABLE__BINDINGS.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - MBindingTable cmd = (MBindingTable) element; - if (cmd.getBindingContextId() != null && cmd.getBindingContextId().trim().length() > 0) { - return cmd.getBindingContextId(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.BINDING_TABLE__BINDING_CONTEXT_ID) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java deleted file mode 100644 index 4e55a7a0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java +++ /dev/null @@ -1,435 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MCommandParameter; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.ComboBoxCellEditor; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class CommandEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private EStackLayout stackLayout; - - public CommandEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.CommandEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.CommandEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - - return parent; - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Name); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_LabelDescription); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - Text t = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 100; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__DESCRIPTION).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.CommandEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.getTable().setHeaderVisible(true); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - viewer.getControl().setLayoutData(gd); - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterId); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MCommandParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - if (value.toString().trim().length() == 0) { - value = null; - } - - Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getElementId() != null ? obj.getElementId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterName); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MCommandParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getName() != null ? obj.getName() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterTypeId); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MCommandParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(viewer) { - private TextCellEditor editor = new TextCellEditor(viewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__TYPE_ID, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.getTypeId() != null ? obj.getTypeId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.CommandEditor_ParameterOptional); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MCommandParameter>(prop.observeDetail(cp.getKnownElements())) { - @Override - public String getText(MCommandParameter element) { - return element.isOptional() ? Messages.CommandEditor_ParameterOptional_Yes : Messages.CommandEditor_ParameterOptional_No; - } - }); - column.setEditingSupport(new EditingSupport(viewer) { - private ComboBoxCellEditor editor = new ComboBoxCellEditor(viewer.getTable(), new String[] { Messages.CommandEditor_ParameterOptional_Yes, Messages.CommandEditor_ParameterOptional_No }); - - @Override - protected void setValue(Object element, Object value) { - int idx = ((Number) value).intValue(); - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.COMMAND_PARAMETER__OPTIONAL, idx == 0); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MCommandParameter obj = (MCommandParameter) element; - return obj.isOptional() ? 0 : 1; - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(viewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) viewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(viewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - IEMFEditListProperty mProp = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS); - viewer.setInput(mProp.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MCommandParameter param = MCommandsFactory.INSTANCE.createCommandParameter(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.COMMAND__PARAMETERS, param); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.editElement(param, 0); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.CommandEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - MCommand cmd = (MCommand) element; - if (cmd.getCommandName() != null && cmd.getCommandName().trim().length() > 0) { - return cmd.getCommandName(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java deleted file mode 100644 index 7c12c0b2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.util.Arrays; -import java.util.List; -import org.eclipse.core.databinding.Binding; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.map.IObservableMap; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FindImportElementDialog; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MContext; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ControlFactory { - public static void createFindImport(Composite parent, final AbstractComponentEditor editor, EMFDataBindingContext context) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - Label l = new Label(parent, SWT.NONE); - l.setText("Reference-Id"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(editor.getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); - b.setImage(editor.getImage(t.getDisplay(), AbstractComponentEditor.SEARCH_IMAGE)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - FindImportElementDialog dialog = new FindImportElementDialog(b.getShell(), editor.getEditingDomain(), (EObject) editor.getMaster().getValue()); - dialog.open(); - } - }); - } - - public static void createSelectedElement(Composite parent, final AbstractComponentEditor editor, final EMFDataBindingContext context, String label) { - Label l = new Label(parent, SWT.NONE); - l.setText(label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IEMFEditListProperty listProp = EMFEditProperties.list(editor.getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - IEMFEditValueProperty labelProp = EMFEditProperties.value(editor.getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - IEMFEditValueProperty idProp = EMFEditProperties.value(editor.getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - - final Binding[] binding = new Binding[1]; - final IObservableValue uiObs = vProp.observe(viewer); - final IObservableValue mObs = EMFEditProperties.value(editor.getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__SELECTED_ELEMENT).observeDetail(editor.getMaster()); - editor.getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (binding[0] != null) { - binding[0].dispose(); - } - - } - }); - - final IObservableList list = listProp.observeDetail(editor.getMaster()); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - IObservableMap[] attributeMaps = { labelProp.observeDetail(cp.getKnownElements()), idProp.observeDetail(cp.getKnownElements()) }; - viewer.setLabelProvider(new ObservableMapLabelProvider(attributeMaps) { - @Override - public String getText(Object element) { - EObject o = (EObject) element; - String rv = o.eClass().getName(); - - if (element instanceof MUILabel) { - MUILabel label = (MUILabel) element; - if (!Util.isNullOrEmpty(label.getLabel())) { - return rv + " - " + label.getLabel().trim(); - } - - } - - if (element instanceof MApplicationElement) { - MApplicationElement appEl = (MApplicationElement) element; - if (!Util.isNullOrEmpty(appEl.getElementId())) { - return rv + " - " + appEl.getElementId(); - } - } - - return rv + "[" + list.indexOf(element) + "]"; - } - }); - viewer.setInput(list); - - editor.getMaster().addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - binding[0] = context.bindValue(uiObs, mObs); - } - }); - } - - public static void createStringListWidget(Composite parent, final AbstractComponentEditor editor, String label, final EStructuralFeature feature, int vIndent) { - Label l = new Label(parent, SWT.NONE); - l.setText(label); - GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); - gd.verticalIndent = vIndent; - l.setLayoutData(gd); - - final Text t = new Text(parent, SWT.BORDER); - gd = new GridData(GridData.FILL, GridData.BEGINNING, true, false); - gd.verticalIndent = vIndent; - t.setLayoutData(gd); - t.addKeyListener(new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.keyCode == SWT.CR || e.keyCode == SWT.LF) { - handleAddText(editor, UiPackageImpl.Literals.CONTEXT__VARIABLES, t); - } - } - }); - - Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_AddNoEllipse); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_ADD_IMAGE)); - gd = new GridData(GridData.FILL, GridData.CENTER, false, false); - gd.verticalIndent = vIndent; - b.setLayoutData(gd); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddText(editor, feature, t); - } - }); - - new Label(parent, SWT.NONE); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new LabelProvider()); - viewer.setContentProvider(new ObservableListContentProvider()); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 150; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(feature); - viewer.setInput(prop.observeDetail(editor.getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Up); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MContext container = (MContext) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Down); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MContext container = (MApplication) editor.getMaster().getValue(); - int idx = container.getVariables().indexOf(obj) + 1; - if (idx < container.getVariables().size()) { - Command cmd = MoveCommand.create(editor.getEditingDomain(), editor.getMaster().getValue(), feature, obj, idx); - - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ControlFactory_Remove); - b.setImage(editor.getImage(b.getDisplay(), AbstractComponentEditor.TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - MContext el = (MContext) editor.getMaster().getValue(); - List<?> ids = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(editor.getEditingDomain(), el, feature, ids); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - if (el.getVariables().size() > 0) { - viewer.setSelection(new StructuredSelection(el.getVariables().get(0))); - } - } - } - } - }); - } - - private static void handleAddText(AbstractComponentEditor editor, EStructuralFeature feature, Text tagText) { - if (tagText.getText().trim().length() > 0) { - String[] tags = tagText.getText().split(";"); //$NON-NLS-1$ - for (int i = 0; i < tags.length; i++) { - tags[i] = tags[i].trim(); - } - - MApplicationElement appEl = (MApplicationElement) editor.getMaster().getValue(); - Command cmd = AddCommand.create(editor.getEditingDomain(), appEl, feature, Arrays.asList(tags)); - if (cmd.canExecute()) { - editor.getEditingDomain().getCommandStack().execute(cmd); - } - tagText.setText(""); //$NON-NLS-1$ - } - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java deleted file mode 100644 index 45998f78..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class DirectMenuItemEditor extends MenuItemEditor { - private Image image; - - public DirectMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.DirectMenuItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.DirectMenuItemEditor_Description; - } - - @Override - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectMenuItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.DirectMenuItemEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java deleted file mode 100644 index 43f64ed3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class DirectToolItemEditor extends ToolItemEditor { - private Image image; - - public DirectToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor, project); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - - @Override - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.DirectToolItemEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value( getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH|SWT.FLAT); - b.setText(Messages.DirectToolItemEditor_Find); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(),project,getEditingDomain(),(MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - - @Override - public String getLabel(Object element) { - return Messages.DirectToolItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.DirectToolItemEditor_Description; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java deleted file mode 100644 index 8ed2596d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledMenuItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class HandledMenuItemEditor extends MenuItemEditor { - private Image image; - private IModelResource resource; - - public HandledMenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { - super(editingDomain,editor,project); - this.resource = resource; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.HandledMenuItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandledMenuItemEditor_Description; - } - - @Override - protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledMenuItemEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Find); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledMenuItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledMenuItemEditor_Tag); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledMenuItemEditor_Value); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - tableviewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - tableviewer.editElement(param, 0); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledMenuItemEditor_Remove); - b.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if (!s.isEmpty()) { - MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java deleted file mode 100644 index e0eb7458..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandledToolItemCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class HandledToolItemEditor extends ToolItemEditor { - private Image image; - private IModelResource resource; - - public HandledToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project, IModelResource resource) { - super(editingDomain, editor, project); - this.resource = resource; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledToolItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledToolItemEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Find); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandledToolItemEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledToolItemEditor_ParametersName); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__NAME, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.HandledToolItemEditor_ParametersValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MParameter>(prop.observeDetail(cp.getKnownElements()))); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.PARAMETER__VALUE, value); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandledItem item = (MHandledItem) master.getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - tableviewer.editElement(param, 0); - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandledToolItemEditor_Remove); - b.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if (!s.isEmpty()) { - MHandledItem item = (MHandledItem) master.getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, s.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - } - - @Override - public String getLabel(Object element) { - return Messages.HandledToolItemEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandledToolItemEditor_Description; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java deleted file mode 100644 index 6788e92a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.HandlerCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class HandlerEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IModelResource resource; - private IProject project; - private EStackLayout stackLayout; - - public HandlerEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource, IProject project) { - super(editingDomain, editor); - this.resource = resource; - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.HandlerEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.HandlerEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.HandlerEditor_Find); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - HandlerCommandSelectionDialog dialog = new HandlerCommandSelectionDialog(b.getShell(), (MHandler) getMaster().getValue(), resource); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.HandlerEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.HandlerEditor_Find); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - MHandler handler = (MHandler) element; - if (handler.getCommand() != null && handler.getCommand().getCommandName() != null && handler.getCommand().getCommandName().trim().length() > 0) { - return handler.getCommand().getCommandName(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java deleted file mode 100644 index b1164d29..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/InputPartEditor.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class InputPartEditor extends PartEditor { - - public InputPartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor, project); - } - - - @Override - public String getLabel(Object element) { - return Messages.InputPartEditor_Label; - } - - @Override - protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.InputPartEditor_InputURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan=2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200,t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.INPUT__INPUT_URI).observeDetail(master)); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java deleted file mode 100644 index 05c8a277..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/KeyBindingEditor.java +++ /dev/null @@ -1,356 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.KeyBindingCommandSelectionDialog; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.MKeySequence; -import org.eclipse.e4.ui.model.application.commands.MParameter; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerSupport; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.jface.viewers.TableViewerEditor; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class KeyBindingEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IModelResource resource; - private EStackLayout stackLayout; - - public KeyBindingEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain, editor); - this.resource = resource; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/KeyBinding.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.KeyBindingEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.KeyBindingEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Sequence); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Command); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setEnabled(false); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID)).observeDetail(getMaster())); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Find); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - KeyBindingCommandSelectionDialog dialog = new KeyBindingCommandSelectionDialog(b.getShell(), (MKeyBinding) getMaster().getValue(), resource); - dialog.open(); - } - }); - } - - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.KeyBindingEditor_Parameters); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 120; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.KeyBindingEditor_ParametersKey); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - ((MParameter) element).setName((String) value); - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getName(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.KeyBindingEditor_ParametersValue); - column.getColumn().setWidth(200); - column.setEditingSupport(new EditingSupport(tableviewer) { - private TextCellEditor cellEditor = new TextCellEditor(tableviewer.getTable()); - - @Override - protected void setValue(Object element, Object value) { - ((MParameter) element).setValue((String) value); - } - - @Override - protected Object getValue(Object element) { - String val = ((MParameter) element).getValue(); - return val == null ? "" : val; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return cellEditor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(tableviewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection) tableviewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent) event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TableViewerEditor.create(tableviewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR); - - ViewerSupport.bind(tableviewer, prop.observeDetail(getMaster()), new IValueProperty[] { EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__NAME), EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.PARAMETER__VALUE) }); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MKeyBinding item = (MKeyBinding) getMaster().getValue(); - MParameter param = MCommandsFactory.INSTANCE.createParameter(); - Command cmd = AddCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, param); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - tableviewer.editElement(param, 0); - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.KeyBindingEditor_Remove); - b.addSelectionListener(new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) tableviewer.getSelection(); - if (!s.isEmpty()) { - MKeyBinding item = (MKeyBinding) getMaster().getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), item, CommandsPackageImpl.Literals.KEY_BINDING__PARAMETERS, s.toList()); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - - }); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - MKeySequence seq = (MKeySequence) element; - if (seq.getKeySequence() != null && seq.getKeySequence().trim().length() > 0) { - return seq.getKeySequence(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(CommandsPackageImpl.Literals.KEY_SEQUENCE__KEY_SEQUENCE) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java deleted file mode 100644 index 8593eb27..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class MenuContributionEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public MenuContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Menu Contribution"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Menu Contribution Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_MenuItems); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuContributionEditor_MenuItemType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuContributionEditor_MenuItemItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.MenuContributionEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuContributionEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuContributionEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuContributionEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuContributionEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java deleted file mode 100644 index 33d7513c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java +++ /dev/null @@ -1,424 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class MenuEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public MenuEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getDescription(Object element) { - return Messages.MenuEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - - createForm(composite, context, getMaster(), false, false); - createForm(composite, context, getMaster(), true, false); - if (getEditor().isModelFragment()) { - createForm(composite, context, getMaster(), false, true); - } - } - EObject o = (EObject) object; - Control topControl; - if (Util.isImport(o) && getEditor().isModelFragment()) { - topControl = composite.getChildren()[2]; - } else if (o.eContainer() instanceof MWindow || o.eContainer() == null) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - if (!rootMenu) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - if (!rootMenu) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - if (!rootMenu) { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.MenuItemEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenu) getMaster().getValue()); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuEditor_MenuItems); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuEditor_MenuItemType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.MenuEditor_MenuItemItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false); - childrenDropDown.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.MenuEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getLabel(Object element) { - MMenu menu = (MMenu) element; - if (menu.getParent() == null) { - EObject o = (EObject) element; - if (o.eContainer() instanceof MWindow) { - return Messages.MenuEditor_MainMenu; - } - } - return Messages.MenuEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - MMenu menu = (MMenu) element; - - if (menu.getLabel() != null && menu.getLabel().trim().length() > 0) { - return menu.getLabel(); - } - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java deleted file mode 100644 index 662a124d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java +++ /dev/null @@ -1,289 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.MenuItemIconDialogEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.ItemType; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class MenuItemEditor extends AbstractComponentEditor { - - private Composite composite; - private Image menuImage; - private EMFDataBindingContext context; - protected IProject project; - private EStackLayout stackLayout; - - public MenuItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (menuImage == null) { - try { - menuImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuItem.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return menuImage; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - IWidgetValueProperty checkProp = WidgetProperties.selection(); - IWidgetValueProperty enabled = WidgetProperties.enabled(); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - if (this.getClass() != MenuItemEditor.class) { - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Type); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); - GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); - } - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Label); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuItemEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setText(Messages.MenuItemEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MMenuItem) getMaster().getValue()); - dialog.open(); - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Enabled"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Selected"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); - - UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(boolean.class, ItemType.class) { - - public Object convert(Object fromObject) { - return null; - } - }); - UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(ItemType.class, boolean.class) { - - public Object convert(Object fromObject) { - return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; - } - }); - - context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t); - - } - - createFormSubTypeForm(parent, context, master); - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master); - - @Override - public IObservableList getChildList(Object element) { - return null; - } - - @Override - public String getDetailLabel(Object element) { - MUILabel label = (MUILabel) element; - if (label.getLabel() != null && label.getLabel().trim().length() > 0) { - return label.getLabel(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java deleted file mode 100644 index 8479ac77..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuSeparatorEditor.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class MenuSeparatorEditor extends AbstractComponentEditor { - private Image separatorImage; - private Composite composite; - private EMFDataBindingContext context; - private EStackLayout stackLayout; - - public MenuSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (separatorImage == null) { - try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return separatorImage; - } - - @Override - public String getLabel(Object element) { - return Messages.MenuSeparatorEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return null; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuSeparatorEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // TODO Should we add visible to mimic a GroupMarker of 3.x - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java deleted file mode 100644 index 708cd12b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java +++ /dev/null @@ -1,421 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; - -import java.util.ArrayList; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.core.databinding.observable.list.WritableList; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - - -import org.eclipse.e4.ui.model.fragment.MModelFragment; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class ModelFragmentsEditor extends AbstractComponentEditor { - - private IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - private IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); - - private Composite composite; - private Image image; - - public ModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ModelFragments.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.ModelFragmentsEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ModelFragmentsEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Imports"); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getImports().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getImports().indexOf(obj) + 1; - if (idx < container.getImports().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - childrenDropDown.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - FeatureClass eClass1 = (FeatureClass) e1; - FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - List<FeatureClass> list = new ArrayList<FeatureClass>(); - addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - - childrenDropDown.setInput(list); - childrenDropDown.getCombo().select(0); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ModelFragmentsEditor_ModelFragments); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getFragments().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getFragments().indexOf(obj) + 1; - if (idx < container.getFragments().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MModelFragment component = MFragmentFactory.INSTANCE.createStringModelFragment(); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, component); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(component); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ModelFragmentsEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - public void addClasses(EPackage ePackage, List<FeatureClass> list) { - for (EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - - @Override - public IObservableList getChildList(Object element) { - WritableList list = new WritableList(); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, "Imports") { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, "Fragments") { - @Override - protected boolean accepted(Object o) { - return true; - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java deleted file mode 100644 index 8f1d50c4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartDescriptorEditor.java +++ /dev/null @@ -1,531 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map.Entry; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartDescriptorIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PartDescriptorEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART_DESCRIPTOR__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR); - private Button createRemoveToolBar; - private EStackLayout stackLayout; - - public PartDescriptorEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PartDescriptorEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartDescriptorEditor_Descriptor; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveToolBar != null) { - createRemoveToolBar.setSelection(((MPartDescriptor) object).getToolbar() != null); - } - - getMaster().setValue(object); - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartDescriptorEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - PartDescriptorIconDialogEditor dialog = new PartDescriptorIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue()); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartDescriptorEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MPartDescriptor) getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ToolBar); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveToolBar = new Button(parent, SWT.CHECK); - createRemoveToolBar.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartDescriptor window = (MPartDescriptor) getMaster().getValue(); - if (window.getToolbar() == null) { - addToolBar(); - } else { - removeToolBar(); - } - } - }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Dirtyable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__DIRTYABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Closeable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CLOSEABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Multiple); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__ALLOW_MULTIPLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Category); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_PersitedState); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateKey); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PersitedStateValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getValue(); - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartDescriptorEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartDescriptorEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Variables); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - ListViewer viewer = new ListViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 80; - viewer.getList().setLayoutData(gd); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartDescriptorEditor_Properties); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - gd.heightHint = 80; - tableviewer.getTable().setHeaderVisible(true); - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesKey); - column.getColumn().setWidth(200); - - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartDescriptorEditor_PropertiesValue); - column.getColumn().setWidth(200); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - private void addToolBar() { - MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - private void removeToolBar() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR__TOOLBAR, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PARTDESCRIPTOR_MENU, PART__MENUS, element, Messages.PartDescriptorEditor_Menus) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartDescriptorEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - MPartDescriptor window = (MPartDescriptor) element; - if (window.getToolbar() != null) { - list.add(0, window.getToolbar()); - } - - PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element) { - createRemoveToolBar.setSelection(false); - } - - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element) { - createRemoveToolBar.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - MPartDescriptor o = (MPartDescriptor) element; - return o.getLabel(); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java deleted file mode 100644 index 00e32c66..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java +++ /dev/null @@ -1,464 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map.Entry; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PartIconDialogEditor; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBar; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PartEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS); - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR); - private Button createRemoveToolBar; - private EStackLayout stackLayout; - - public PartEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PartEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveToolBar != null) { - createRemoveToolBar.setSelection(((MPart) object).getToolbar() != null); - } - - getMaster().setValue(object); - - return composite; - } - - protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - final Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPart) getMaster().getValue()); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PartEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ToolBar); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveToolBar = new Button(parent, SWT.CHECK); - createRemoveToolBar.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPart window = (MPart) getMaster().getValue(); - if (window.getToolbar() == null) { - addToolBar(); - } else { - removeToolBar(); - } - } - }); - createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } - - createSubformElements(parent, context, master); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_Closeable); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button checkbox = new Button(parent, SWT.CHECK); - checkbox.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1)); - - IEMFEditValueProperty mprop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE); - IWidgetValueProperty uiProp = WidgetProperties.selection(); - - context.bindValue(uiProp.observe(checkbox), mprop.observeDetail(master)); - } - - // ------------------------------------------------------------ - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartEditor_PersitedState); - GridData gd = new GridData(GridData.END, GridData.BEGINNING, false, false); - gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; - l.setLayoutData(gd); - - TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - gd.verticalIndent = VERTICAL_LIST_WIDGET_INDENT; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartEditor_PersitedStateKey); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText(Messages.PartEditor_PersitedStateValue); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getValue(); - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - private void addToolBar() { - MToolBar menu = MMenuFactory.INSTANCE.createToolBar(); - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - private void removeToolBar() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - protected void createSubformElements(Composite parent, EMFDataBindingContext context, IObservableValue master) { - - } - - @Override - public IObservableList getChildList(Object element) { - final WritableList list = new WritableList(); - - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartEditor_Handlers) { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - MPart window = (MPart) element; - if (window.getToolbar() != null) { - list.add(0, window.getToolbar()); - } - - PART__TOOLBAR.observe(element).addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - createRemoveToolBar.setSelection(false); - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - createRemoveToolBar.setSelection(true); - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - MPart o = (MPart) element; - return o.getLabel(); - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java deleted file mode 100644 index 1435e6e1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java +++ /dev/null @@ -1,365 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.IViewerValueProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PartSashContainerEditor extends AbstractComponentEditor { - - private Composite composite; - private Image vImage; - private Image hImage; - private EMFDataBindingContext context; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - public PartSashContainerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - boolean horizontal = ((MPartSashContainer) element).isHorizontal(); - - if (vImage == null && !horizontal) { - try { - vImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if (hImage == null && horizontal) { - try { - hImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - if (horizontal) { - return hImage; - } else { - return vImage; - } - } - - @Override - public String getLabel(Object element) { - return Messages.PartSashContainerEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartSashContainerEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_Orientation); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((Boolean) element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal : Messages.PartSashContainerEditor_Vertical; - } - }); - viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE }); - IViewerValueProperty vProp = ViewerProperties.singleSelection(); - context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartSashContainerEditor_Controls); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartSashContainerEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java deleted file mode 100644 index 6c82eb7b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ /dev/null @@ -1,317 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StackLayout; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PartStackEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private StackLayout stackLayout; - - public PartStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PartStackEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.PartStackEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_ContainerData); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PartStackEditor_Parts); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java deleted file mode 100644 index 65528d5a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java +++ /dev/null @@ -1,384 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.PerspectiveIconDialogEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PerspectiveEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - public PerspectiveEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Perspective.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PerspectiveEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - MPerspective perspective = (MPerspective) element; - if (perspective.getLabel() != null && perspective.getLabel().trim().length() > 0) { - return perspective.getLabel(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } - - @Override - public String getDescription(Object element) { - return Messages.PerspectiveEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_LabelLabel); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Tooltip); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_IconURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Find); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), project, getEditingDomain(), (MPerspective) getMaster().getValue()); - dialog.open(); - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveEditor_Controls); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.PART_SASH_CONTAINER, BasicPackageImpl.Literals.PART_STACK, BasicPackageImpl.Literals.PART, BasicPackageImpl.Literals.INPUT_PART, AdvancedPackageImpl.Literals.PLACEHOLDER }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART_SASH_CONTAINER)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PerspectiveEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java deleted file mode 100644 index 46f968a2..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java +++ /dev/null @@ -1,285 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PerspectiveStackEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - public PerspectiveStackEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PerspectiveStackEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.PerspectiveStackEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveStackEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PerspectiveStackEditor_Perspectives); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setText(Messages.PerspectiveStackEditor_Add); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective(); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.PartStackEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java deleted file mode 100644 index b0571a0d..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PlaceholderEditor.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.SharedElementsDialog; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUIElement; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class PlaceholderEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IModelResource resource; - private EStackLayout stackLayout; - - public PlaceholderEditor(EditingDomain editingDomain, ModelEditor editor, IModelResource resource) { - super(editingDomain, editor); - this.resource = resource; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Placeholder.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.PlaceholderEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - MPlaceholder pl = (MPlaceholder) element; - if (pl.getRef() != null) { - StringBuilder b = new StringBuilder(); - - b.append(((EObject) pl.getRef()).eClass().getName()); - if (pl.getRef() instanceof MUILabel) { - MUILabel label = (MUILabel) pl.getRef(); - if (label.getLabel() != null && label.getLabel().trim().length() > 0) { - b.append(" (" + label.getLabel() + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } else if (label.getTooltip() != null && label.getTooltip().trim().length() > 0) { - b.append(" (" + label.getTooltip() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { - b.append(pl.getRef().getElementId()); - } - } - } else { - if (pl.getRef().getElementId() != null && pl.getRef().getElementId().trim().length() > 0) { - b.append(" (" + pl.getRef().getElementId() + ")"); //$NON-NLS-1$//$NON-NLS-2$ - } - } - - return b.toString(); - } - - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.PlaceholderEditor_Descriptor; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.PlaceholderEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Reference"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setEditable(false); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - - UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(String.class, MUIElement.class) { - - public Object convert(Object fromObject) { - return null; - } - }); - UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(MUIElement.class, String.class) { - - public Object convert(Object fromObject) { - if (fromObject != null) { - EObject o = (EObject) fromObject; - if (o instanceof MUILabel) { - MUILabel label = (MUILabel) o; - if (!Util.isNullOrEmpty(label.getLabel())) { - return o.eClass().getName() + " - " + label.getLabel(); - } - } - - return o.eClass().getName() + " - " + ((MUIElement) fromObject).getElementId(); - } - return null; - } - }); - - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), AdvancedPackageImpl.Literals.PLACEHOLDER__REF).observeDetail(getMaster()), t2m, m2t); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setText(Messages.PlaceholderEditor_FindReference); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - SharedElementsDialog dialog = new SharedElementsDialog(b.getShell(), getEditor(), (MPlaceholder) getMaster().getValue(), resource); - dialog.open(); - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java deleted file mode 100644 index 0bc7185b..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java +++ /dev/null @@ -1,380 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.jface.viewers.Viewer; - -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.FeatureSelectionDialog; - -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; - -import org.eclipse.emf.ecore.EPackage; - -import java.util.ArrayList; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - -import org.eclipse.emf.ecore.EClassifier; - -import org.eclipse.e4.ui.model.fragment.MModelFragment; - -import java.util.List; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.emf.databinding.EMFProperties; - -import org.eclipse.e4.tools.emf.ui.internal.Messages; - -import java.net.MalformedURLException; -import java.net.URL; - -import org.eclipse.emf.databinding.EMFDataBindingContext; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; - -public class StringModelFragment extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - - public StringModelFragment(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/StringModelFragment.png")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.StringModelFragment_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.StringModelFragment_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent); - } - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster())); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_Featurename); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Composite comp = new Composite(parent, SWT.NONE); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - comp.setLayoutData(gd); - GridLayout gl = new GridLayout(2,false); - gl.marginWidth=gl.marginHeight=0; - gl.verticalSpacing=0; - gl.marginLeft=gl.marginBottom=gl.marginRight=gl.marginTop=0; - comp.setLayout(gl); - - Text t = new Text(comp, SWT.BORDER); - gd = new GridData(GridData.FILL_HORIZONTAL); - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster())); - - final Button button = new Button(comp, SWT.PUSH | SWT.FLAT); - button.setText(Messages.StringModelFragment_Find); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(),getEditingDomain(),(MStringModelFragment) getMaster().getValue()); - dialog.open(); - } - }); - - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_PositionInList); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.StringModelFragment_Elements); - l.setLayoutData(new GridData(GridData.END,GridData.BEGINNING,false,false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragment container = (MModelFragment) getMaster().getValue(); - int idx = container.getElements().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragment container = (MModelFragment) getMaster().getValue(); - int idx = container.getElements().indexOf(obj) + 1; - if (idx < container.getElements().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - childrenDropDown.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - FeatureClass eClass1 = (FeatureClass) e1; - FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - List<FeatureClass> list = new ArrayList<FeatureClass>(); - addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS)); - - childrenDropDown.setInput(list); - childrenDropDown.getCombo().select(0); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.StringModelFragment_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - public void addClasses(EPackage ePackage, List<FeatureClass> list) { - for (EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - - public void dispose() { - if (image != null) { - image.dispose(); - image = null; - } - - if (composite != null) { - composite.dispose(); - composite = null; - } - - if (context != null) { - context.dispose(); - context = null; - } - } - - @Override - public IObservableList getChildList(Object element) { - return MODEL_FRAGMENT__ELEMENTS.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java deleted file mode 100644 index 220e61d4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ToolBarContributionEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public ToolBarContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "ToolBar Contribution"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "ToolBar Contribution Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java deleted file mode 100644 index 8a644d31..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ToolBarEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public ToolBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBar.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return image; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolBarEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ToolBarEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarEditor_ToolbarItems); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsType); - column.getColumn().setWidth(300); - column.setLabelProvider(new ComponentLabelProvider(getEditor())); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText(Messages.ToolBarEditor_ToolbarItemsItemType); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(master)); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - Struct struct = (Struct) element; - return struct.label; - } - }); - - Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false); - childrenDropDown.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) }); - childrenDropDown.setSelection(new StructuredSelection(defaultStruct)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!childrenDropDown.getSelection().isEmpty()) { - Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement(); - EClass eClass = struct.eClass; - MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if (!struct.separator) { - getEditor().setSelection(eObject); - } - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.ToolBarEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, keybinding); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java deleted file mode 100644 index a8eeac79..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ToolBarSeparatorEditor extends AbstractComponentEditor { - private Image separatorImage; - private Composite composite; - private EMFDataBindingContext context; - private EStackLayout stackLayout; - - public ToolBarSeparatorEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - if (separatorImage == null) { - try { - separatorImage = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarSeparator.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return separatorImage; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolBarSeparatorEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return null; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolBarSeparatorEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java deleted file mode 100644 index f1344ce3..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map.Entry; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionClassDialog; -import org.eclipse.e4.ui.model.application.MContribution; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ColumnLabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class ToolControlEditor extends AbstractComponentEditor { - private Image image; - private EMFDataBindingContext context; - private Composite composite; - private IProject project; - private EStackLayout stackLayout; - - public ToolControlEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public String getLabel(Object element) { - return Messages.ToolControlEditor_Label; - } - - @Override - public String getDescription(Object element) { - return Messages.ToolControlEditor_Description; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolControl.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getDetailLabel(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolControlEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.ToolControlEditor_ClassURI); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master)); - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.setImage(getImage(t.getDisplay(), SEARCH_IMAGE)); - b.setText("Find ..."); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), project, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - dialog.open(); - } - }); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Persited State"); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - TableViewer tableviewer = new TableViewer(parent); - tableviewer.getTable().setHeaderVisible(true); - ObservableListContentProvider cp = new ObservableListContentProvider(); - tableviewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 80; - tableviewer.getControl().setLayoutData(gd); - - TableViewerColumn column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Key"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getKey(); - } - }); - - // FIXME How can we react upon changes in the Map-Value? - column = new TableViewerColumn(tableviewer, SWT.NONE); - column.getColumn().setText("Value"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ColumnLabelProvider() { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) { - Entry<String, String> entry = (Entry<String, String>) element; - return entry.getValue(); - } - }); - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__PERSISTED_STATE); - tableviewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java deleted file mode 100644 index 9d2f9401..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolItemEditor.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.core.databinding.UpdateValueStrategy; -import org.eclipse.core.databinding.conversion.Converter; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ToolItemIconDialogEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.ItemType; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public abstract class ToolItemEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - protected IProject project; - private EStackLayout stackLayout; - - public ToolItemEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(master)); - - createFormSubTypeForm(parent, context, master); - - return parent; - } - - private void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) { - IValueProperty textProp = WidgetProperties.text(SWT.Modify); - IWidgetValueProperty checkProp = WidgetProperties.selection(); - IWidgetValueProperty enabled = WidgetProperties.enabled(); - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Type"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO }); - GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Label"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observe(t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - ToolItemIconDialogEditor dialog = new ToolItemIconDialogEditor(b.getShell(), project, getEditingDomain(), (MToolItem) getMaster().getValue()); - dialog.open(); - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Enabled"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster())); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Selected"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Button b = new Button(parent, SWT.CHECK); - b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster())); - - UpdateValueStrategy t2m = new UpdateValueStrategy(); - t2m.setConverter(new Converter(boolean.class, ItemType.class) { - - public Object convert(Object fromObject) { - return null; - } - }); - UpdateValueStrategy m2t = new UpdateValueStrategy(); - m2t.setConverter(new Converter(ItemType.class, boolean.class) { - - public Object convert(Object fromObject) { - return fromObject == ItemType.CHECK || fromObject == ItemType.RADIO; - } - }); - - context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t); - - } - - // ------------------------------------------------------------ - - createSubTypeFormElements(parent, context, master); - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - } - - protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, WritableValue master) { - - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDetailLabel(Object element) { - MToolItem item = (MToolItem) element; - if (item.getLabel() != null && item.getLabel().trim().length() > 0) { - return item.getLabel(); - } else if (item.getTooltip() != null && item.getTooltip().trim().length() > 0) { - return item.getTooltip(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__TOOLTIP) }; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java deleted file mode 100644 index cf552004..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.MGenericTrimContainer; -import org.eclipse.e4.ui.model.application.ui.SideValue; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ViewerProperties; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class TrimBarEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private ModelEditor editor; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - public TrimBarEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - this.editor = editor; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Window Trim"; - } - - @Override - public String getDescription(Object element) { - return "Window Trim bla bla bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Side"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - ComboViewer viewer = new ComboViewer(parent); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setInput(SideValue.values()); - GridData gd = new GridData(); - gd.horizontalSpan = 2; - viewer.getControl().setLayoutData(gd); - IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE).observeDetail(master); - context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new ComponentLabelProvider(editor)); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer typeViewer = new ComboViewer(buttonComp, SWT.READ_ONLY); - typeViewer.setContentProvider(new ArrayContentProvider()); - typeViewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((EClass) element).getName(); - } - }); - typeViewer.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); - typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - editor.setSelection(toolbar); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - - @Override - public String getDetailLabel(Object element) { - MGenericTrimContainer<?> trim = (MGenericTrimContainer<?>) element; - - if (trim.getSide() != null) { - return trim.getSide().toString(); - } - - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE) }; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java deleted file mode 100644 index d3fa9a9a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class TrimContributionEditor extends AbstractComponentEditor { - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private EStackLayout stackLayout; - - private static class Struct { - private final String label; - private final EClass eClass; - private final boolean separator; - - public Struct(String label, EClass eClass, boolean separator) { - this.label = label; - this.eClass = eClass; - this.separator = separator; - } - } - - public TrimContributionEditor(EditingDomain editingDomain, IProject project, ModelEditor editor) { - super(editingDomain, editor); - this.project = project; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif")); //$NON-NLS-1$ - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Trim Contribution"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Trim Contribution Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - getMaster().setValue(object); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Id); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_ParentId); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.MenuContributionEditor_Position); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); - l.setLayoutData(new GridData(GridData.END, GridData.BEGINNING, false, false)); - - final TableViewer viewer = new TableViewer(parent); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - viewer.setContentProvider(new ObservableListContentProvider()); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if (idx < container.getChildren().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer typeViewer = new ComboViewer(buttonComp, SWT.READ_ONLY); - typeViewer.setContentProvider(new ArrayContentProvider()); - typeViewer.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - return ((EClass) element).getName(); - } - }); - typeViewer.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL }); - typeViewer.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EObject toolbar = EcoreUtil.create((EClass) ((IStructuredSelection) typeViewer.getSelection()).getFirstElement()); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(toolbar); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - return ELEMENT_CONTAINER__CHILDREN.observe(element); - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java deleted file mode 100644 index b00e589e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimmedWindowEditor.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.edit.domain.EditingDomain; - -public class TrimmedWindowEditor extends WindowEditor { - private IListProperty TRIMMED_WINDOW__TRIM_BARS = EMFProperties.list(BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS); - - public TrimmedWindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain,editor, project); - } - - public IObservableList getChildList(Object element) { - IObservableList list = super.getChildList(element); - - if( getEditor().isModelFragment() && Util.isImport((EObject) element) ) { - return list; - } - - list.add(new VirtualEntry<Object>( ModelEditor.VIRTUAL_TRIMMED_WINDOW_TRIMS, TRIMMED_WINDOW__TRIM_BARS, element, "TrimBars") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - return list; - } - - @Override - public String getLabel(Object element) { - return "Trimmed Window"; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java deleted file mode 100644 index f025d062..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java +++ /dev/null @@ -1,428 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.core.databinding.property.list.IListProperty; -import org.eclipse.core.databinding.property.value.IValueProperty; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.EStackLayout; -import org.eclipse.e4.tools.emf.ui.common.ImageTooltip; -import org.eclipse.e4.tools.emf.ui.common.Util; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.WindowIconDialogEditor; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.MUILabel; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.swt.IWidgetValueProperty; -import org.eclipse.jface.databinding.swt.WidgetProperties; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class WindowEditor extends AbstractComponentEditor { - - private Composite composite; - private Image image; - private EMFDataBindingContext context; - private IProject project; - - private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS); - private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS); - private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - private IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); - private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU); - - private Action addMainMenu; - private Button createRemoveMainMenu; - private EStackLayout stackLayout; - - public WindowEditor(EditingDomain editingDomain, ModelEditor editor, IProject project) { - super(editingDomain, editor); - this.project = project; - addMainMenu = new Action("Add Main Menu") { - @Override - public void run() { - addMenu(); - } - }; - } - - @Override - public Image getImage(Object element, Display display) { - if (image == null) { - try { - image = loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif")); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - return image; - } - - @Override - public String getLabel(Object element) { - return "Window"; - } - - @Override - public String getDescription(Object element) { - return "Window bla bla bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - if (getEditor().isModelFragment()) { - composite = new Composite(parent, SWT.NONE); - stackLayout = new EStackLayout(); - composite.setLayout(stackLayout); - createForm(composite, context, getMaster(), false); - createForm(composite, context, getMaster(), true); - } else { - composite = createForm(parent, context, getMaster(), false); - } - } - - if (getEditor().isModelFragment()) { - Control topControl; - if (Util.isImport((EObject) object)) { - topControl = composite.getChildren()[1]; - } else { - topControl = composite.getChildren()[0]; - } - - if (stackLayout.topControl != topControl) { - stackLayout.topControl = topControl; - composite.layout(true, true); - } - } - - if (createRemoveMainMenu != null) { - createRemoveMainMenu.setSelection(((MWindow) object).getMainMenu() != null); - } - - getMaster().setValue(object); - - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify); - - if (isImport) { - ControlFactory.createFindImport(parent, this, context); - return parent; - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Id"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("X"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Y"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Width"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Height"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster())); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Label"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Tooltip"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - t.setLayoutData(gd); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP).observeDetail(master)); - } - - // ------------------------------------------------------------ - { - Label l = new Label(parent, SWT.NONE); - l.setText("Icon URI"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - Text t = new Text(parent, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master)); - - new ImageTooltip(t) { - - @Override - protected URI getImageURI() { - MUILabel part = (MUILabel) getMaster().getValue(); - String uri = part.getIconURI(); - if (uri == null || uri.trim().length() == 0) { - return null; - } - return URI.createURI(part.getIconURI()); - } - }; - - final Button b = new Button(parent, SWT.PUSH | SWT.FLAT); - b.setText("Find ..."); - b.setImage(getImage(b.getDisplay(), SEARCH_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), project, getEditingDomain(), (MWindow) getMaster().getValue()); - dialog.open(); - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Main Menu"); - l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); - - createRemoveMainMenu = new Button(parent, SWT.CHECK); - createRemoveMainMenu.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MWindow window = (MWindow) getMaster().getValue(); - if (window.getMainMenu() == null) { - addMenu(); - } else { - removeMenu(); - } - } - }); - createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - } - - ControlFactory.createSelectedElement(parent, this, context, "Selected Element"); - ControlFactory.createStringListWidget(parent, this, "Binding Contexts", CommandsPackageImpl.Literals.BINDINGS__BINDING_CONTEXTS, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Variables", UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT); - ControlFactory.createStringListWidget(parent, this, "Tags", ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT); - - return parent; - } - - void removeMenu() { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - void addMenu() { - MMenu menu = MMenuFactory.INSTANCE.createMenu(); - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - public IObservableList getChildList(final Object element) { - final WritableList list = new WritableList(); - if (getEditor().isModelFragment() && Util.isImport((EObject) element)) { - return list; - } - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, "Handlers") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOWS, WINDOW__WINDOWS, element, "Windows") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, "Controls") { - - @Override - protected boolean accepted(Object o) { - return true; - } - - }); - - list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, "Shared Elements") { - protected boolean accepted(Object o) { - return true; - } - }); - - MWindow window = (MWindow) element; - if (window.getMainMenu() != null) { - list.add(0, window.getMainMenu()); - } - - WINDOW__MAIN_MENU.observe(element).addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - if (event.diff.getOldValue() != null) { - list.remove(event.diff.getOldValue()); - if (getMaster().getValue() == element) { - createRemoveMainMenu.setSelection(false); - } - } - - if (event.diff.getNewValue() != null) { - list.add(0, event.diff.getNewValue()); - if (getMaster().getValue() == element) { - createRemoveMainMenu.setSelection(true); - } - } - } - }); - - return list; - } - - @Override - public String getDetailLabel(Object element) { - MWindow window = (MWindow) element; - if (window.getLabel() != null && window.getLabel().trim().length() > 0) { - return window.getLabel(); - } - return null; - } - - @Override - public FeaturePath[] getLabelProperties() { - return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL) }; - } - - @Override - public List<Action> getActions(Object element) { - List<Action> actions = new ArrayList<Action>(); - - MWindow window = (MWindow) element; - if (window.getMainMenu() == null) { - actions.add(addMainMenu); - } - - return actions; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java deleted file mode 100644 index 6134c2a0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.emf.common.util.TreeIterator; - -import org.eclipse.emf.ecore.util.EcoreUtil; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public abstract class AbstractCommandSelectionDialog extends TitleAreaDialog { - private IModelResource resource; - private TableViewer viewer; - - public AbstractCommandSelectionDialog(Shell parentShell, IModelResource resource) { - super(parentShell); - this.resource = resource; - } - - protected abstract String getShellTitle(); - protected abstract String getDialogTitle(); - protected abstract String getDialogMessage(); - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - getShell().setText( getShellTitle()); - setTitle( getDialogTitle() ); - setMessage( getDialogMessage() ); - - final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.AbstractCommandSelectionDialog_Label_CommandId); - - Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - List<EObject> commands = new ArrayList<EObject>(); - TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject)resource.getRoot().get(0), true); - while( it.hasNext() ) { - EObject o = it.next(); - if( o.eClass() == CommandsPackageImpl.Literals.COMMAND ) { - commands.add(o); - } - } - viewer.setInput(commands); - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); - - return composite; - } - - @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - Command cmd = createStoreCommand( resource.getEditingDomain(), (MCommand) s.getFirstElement() ); - if( cmd.canExecute() ) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - protected abstract Command createStoreCommand( EditingDomain editingDomain, MCommand command); - - private static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - - public void update(final ViewerCell cell) { - MCommand cmd = (MCommand) cell.getElement(); - - StyledString styledString = new StyledString(); - if( cmd.getCommandName() != null ) { - styledString.append(cmd.getCommandName()); - } - if( cmd.getDescription() != null ) { - styledString.append(" - " + cmd.getDescription(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - if( cmd.getElementId() != null ) { - styledString.append(" - " + cmd.getElementId(),StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - MCommand command = (MCommand) element; - String s = ""; //$NON-NLS-1$ - if( command.getCommandName() != null ) { - s += command.getCommandName(); - } - - if( command.getDescription() != null ) { - s += " " + command.getDescription(); //$NON-NLS-1$ - } - - if( command.getElementId() != null ) { - s += " " + command.getElementId(); //$NON-NLS-1$ - } - - return s; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java deleted file mode 100644 index a054c2c7..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java +++ /dev/null @@ -1,299 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Timer; -import java.util.TimerTask; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -public abstract class AbstractIconDialog extends TitleAreaDialog { - private TableViewer viewer; - private IProject project; - private MApplicationElement element; - private EStructuralFeature feature; - private EditingDomain editingDomain; - private Map<IFile, Image> icons = Collections.synchronizedMap(new HashMap<IFile, Image>()); - - public AbstractIconDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement element, EStructuralFeature feature) { - super(parentShell); - this.editingDomain = editingDomain; - this.element = element; - this.feature = feature; - this.project = project; - } - - protected abstract String getShellTitle(); - - protected abstract String getDialogTitle(); - - protected abstract String getDialogMessage(); - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - getShell().setText(getShellTitle()); - setTitle(getDialogTitle()); - setMessage(getDialogMessage()); - - Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText("IconName"); - - final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - - viewer = new TableViewer(container); - GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - IFile file = (IFile) cell.getElement(); - StyledString styledString = new StyledString(file.getProjectRelativePath().toString(), null); - - Image img = icons.get(file); - if (img == null) { - InputStream in = null; - try { - in = file.getContents(); - img = new Image(cell.getControl().getDisplay(), in); - icons.put(file, img); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - - String bundle = getBundle(file); - if( bundle != null ) { - styledString.append(" - " + bundle, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setImage(img); - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - - final WritableList list = new WritableList(); - viewer.setInput(list); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - t.addModifyListener(new ModifyListener() { - private IconMatchCallback callback; - private Timer timer = new Timer(true); - private TimerTask task; - - public void modifyText(ModifyEvent e) { - if (callback != null) { - callback.cancel = true; - } - if (task != null) { - task.cancel(); - } - list.clear(); - - clearImages(); - - callback = new IconMatchCallback(list); - task = new SearchThread(callback, t.getText(), project); - timer.schedule(task, 500); - } - }); - - getShell().addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - clearImages(); - } - }); - - return comp; - } - - private void clearImages() { - for (Image img : icons.values()) { - img.dispose(); - } - icons.clear(); - } - - @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - IFile file = (IFile) s.getFirstElement(); - String bundle = getBundle(file); - String uri = "platform:/plugin/"+bundle+"/"+file.getProjectRelativePath().toString(); - Command cmd = SetCommand.create(editingDomain, element, feature, uri); - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private String getBundle(IFile file) { - IProject project = file.getProject(); - IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ - - if (f != null && f.exists()) { - BufferedReader r = null; - try { - InputStream s = f.getContents(); - r = new BufferedReader(new InputStreamReader(s)); - String line; - while ((line = r.readLine()) != null) { - if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - int start = line.indexOf(':'); - int end = line.indexOf(';'); - if (end == -1) { - end = line.length(); - } - return line.substring(start + 1, end).trim(); - } - } - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (r != null) { - try { - r.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - return null; - } - - private class IconMatchCallback { - private volatile boolean cancel; - private IObservableList list; - - private IconMatchCallback(IObservableList list) { - this.list = list; - } - - public void match(final IFile file) { - if (!cancel) { - list.getRealm().exec(new Runnable() { - - public void run() { - list.add(file); - } - }); - } - } - } - - private static class SearchThread extends TimerTask { - private final IconMatchCallback callback; - private final IProject project; - private final StringMatcher matcherGif; - private final StringMatcher matcherJpg; - private final StringMatcher matcherPng; - - public SearchThread(IconMatchCallback callback, String pattern, IProject project) { - this.matcherGif = new StringMatcher("*" + pattern + "*.gif", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.matcherJpg = new StringMatcher("*" + pattern + "*.jpg", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.matcherPng = new StringMatcher("*" + pattern + "*.png", true, false); //$NON-NLS-1$//$NON-NLS-2$ - this.callback = callback; - this.project = project; - } - - @Override - public void run() { - try { - project.accept(new IResourceVisitor() { - - public boolean visit(IResource resource) throws CoreException { - if (callback.cancel) { - return false; - } - - if (resource.getType() == IResource.FOLDER || resource.getType() == IResource.PROJECT) { - return true; - } else if (resource.getType() == IResource.FILE && !resource.isLinked()) { - String path = resource.getProjectRelativePath().toString(); - if (matcherGif.match(path) || matcherPng.match(path) || matcherJpg.match(path)) { - callback.match((IFile) resource); - } - } - return false; - } - - }); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java deleted file mode 100644 index 005cba05..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler; -import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector; -import org.eclipse.e4.ui.model.application.MApplicationElement; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; - -public class ContributionClassDialog extends TitleAreaDialog { - private IProject project; - private Image javaClassImage; - private MApplicationElement contribution; - private EditingDomain editingDomain; - private TableViewer viewer; - private EStructuralFeature feature; - - public ContributionClassDialog(Shell parentShell, IProject project, EditingDomain editingDomain, MApplicationElement contribution, EStructuralFeature feature) { - super(parentShell); - this.project = project; - this.contribution = contribution; - this.editingDomain = editingDomain; - this.feature = feature; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - getShell().setText(Messages.ContributionClassDialog_ShellTitle); - setTitle(Messages.ContributionClassDialog_DialogTitle); - setMessage(Messages.ContributionClassDialog_DialogMessage); - - final Image titleImage = new Image(comp.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newclass_wiz.png")); - setTitleImage(titleImage); - - getShell().addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - javaClassImage.dispose(); - titleImage.dispose(); - } - }); - - javaClassImage = new Image(getShell().getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - - Composite container = new Composite(comp, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2,false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.ContributionClassDialog_Label_Classname); - - final Text t = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container,SWT.NONE); - - viewer = new TableViewer(container); - GridData gd = new GridData(GridData.FILL_BOTH); - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new StyledCellLabelProvider() { - @Override - public void update(ViewerCell cell) { - ContributionData data = (ContributionData) cell.getElement(); - StyledString styledString = new StyledString(data.className, null); - - if( data.bundleName != null ) { - styledString.append(" - " + data.bundleName, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - if( data.sourceType != null ) { - styledString.append(" - ", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - styledString.append(data.sourceType + "", StyledString.COUNTER_STYLER); //$NON-NLS-1$ - } - - if( data.iconPath == null ) { - cell.setImage(javaClassImage); - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - - final WritableList list = new WritableList(); - viewer.setInput(list); - - final ClassContributionCollector collector = getCollector(); - - t.addModifyListener(new ModifyListener() { - private ContributionResultHandlerImpl currentResultHandler; - - public void modifyText(ModifyEvent e) { - if( currentResultHandler != null ) { - currentResultHandler.cancled = true; - } - list.clear(); - currentResultHandler = new ContributionResultHandlerImpl(list); - Filter filter = new Filter(project, t.getText()); - collector.findContributions(filter, currentResultHandler); - } - }); - - return comp; - } - - @Override - protected void okPressed() { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if( ! s.isEmpty() ) { - ContributionData cd = (ContributionData) s.getFirstElement(); - String uri = "platform:/plugin/" + cd.bundleName + "/" + cd.className; //$NON-NLS-1$ //$NON-NLS-2$ - Command cmd = SetCommand.create(editingDomain, contribution, feature, uri); - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private ClassContributionCollector getCollector() { - Bundle bundle = FrameworkUtil.getBundle(ContributionClassDialog.class); - BundleContext context = bundle.getBundleContext(); - ServiceReference ref = context.getServiceReference(ClassContributionCollector.class.getName()); - if( ref != null ) { - return (ClassContributionCollector) context.getService(ref); - } - return null; - } - - private static class ContributionResultHandlerImpl implements ContributionResultHandler { - private boolean cancled = false; - private IObservableList list; - - public ContributionResultHandlerImpl(IObservableList list) { - this.list = list; - } - - public void result(ContributionData data) { - if( ! cancled ) { - list.add(data); - } - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java deleted file mode 100644 index 0b490855..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ /dev/null @@ -1,441 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import java.text.BreakIterator; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.StringMatcher; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; -import org.eclipse.e4.ui.model.internal.ModelUtils; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -@SuppressWarnings("restriction") -public class FeatureSelectionDialog extends TitleAreaDialog { - private TreeViewer viewer; - private MStringModelFragment fragment; - private EditingDomain editingDomain; - - public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment) { - super(parentShell); - this.fragment = fragment; - this.editingDomain = editingDomain; - } - - @Override - protected Control createDialogArea(Composite parent) { - getShell().setText(Messages.FeatureSelectionDialog_ShellTitle); - setTitle(Messages.FeatureSelectionDialog_DialogTitle); - setMessage(Messages.FeatureSelectionDialog_DialogMessage); - - - Composite composite = (Composite) super.createDialogArea(parent); - - final Image packageImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/EPackage.gif")); //$NON-NLS-1$ - final Image classImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/class_obj.gif")); //$NON-NLS-1$ - final Image featureImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/obj16/field_public_obj.gif")); //$NON-NLS-1$ - final Image newTitleImage = new Image(getShell().getDisplay(),getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/fieldrefact_wiz.png")); //$NON-NLS-1$ - - setTitleImage(newTitleImage); - - composite.addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - packageImage.dispose(); - classImage.dispose(); - featureImage.dispose(); - newTitleImage.dispose(); - } - }); - - - Composite container = new Composite(composite, SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(2, false)); - - Label l = new Label(container, SWT.NONE); - l.setText(Messages.FeatureSelectionDialog_Filter); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - new Label(container, SWT.NONE); - viewer = new TreeViewer(container); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint=200; - viewer.getControl().setLayoutData(gd); - viewer.setContentProvider(new ContentProviderImpl()); - viewer.setLabelProvider(new LabelProviderImpl(packageImage,classImage,featureImage)); - viewer.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - viewer.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - if( e1.getClass() == InternalPackage.class ) { - return ((InternalPackage)e1).ePackage.getNsURI().compareTo(((InternalPackage)e2).ePackage.getNsURI()); - } else if( e1.getClass() == InternalClass.class ) { - return ((InternalClass)e1).eClass.getName().compareTo(((InternalClass)e2).eClass.getName()); - } else if( e1.getClass() == InternalFeature.class ) { - return ((InternalFeature)e1).feature.getName().compareTo(((InternalFeature)e2).feature.getName()); - } - return super.compare(viewer, e1, e2); - } - }); - - final ViewerFilterImpl filter = new ViewerFilterImpl(); - - viewer.addFilter(filter); - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(searchText.getText()); - viewer.refresh(); - } - }); - - - viewer.setInput(loadPackages()); - - return composite; - } - - @Override - protected void okPressed() { - IStructuredSelection sel = (IStructuredSelection) viewer.getSelection(); - if( ! sel.isEmpty() && sel.getFirstElement().getClass() == InternalFeature.class ) { - InternalFeature f = (InternalFeature) sel.getFirstElement(); - Command cmd = SetCommand.create(editingDomain, fragment, FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME, f.feature.getName()); - - if( cmd.canExecute() ) { - editingDomain.getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private static List<InternalPackage> loadPackages() { - List<InternalPackage> packs = new ArrayList<InternalPackage>(); - - for( Entry<String, Object> regEntry : EPackage.Registry.INSTANCE.entrySet() ) { - if( regEntry.getValue() instanceof EPackage ) { - EPackage ePackage = (EPackage) regEntry.getValue(); - InternalPackage iePackage = new InternalPackage(ePackage); - boolean found = false; - for( EClassifier cl : ePackage.getEClassifiers() ) { - if( cl instanceof EClass ) { - EClass eClass = (EClass) cl; - if( eClass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT) ) { - if( ! eClass.isInterface() && ! eClass.isAbstract() ) { - found = true; - InternalClass ieClass = new InternalClass(iePackage, eClass); - iePackage.classes.add(ieClass); - for( EReference f : eClass.getEAllReferences() ) { - ieClass.features.add(new InternalFeature(ieClass, f)); - } - } - } - } - } - if( found ) { - packs.add(iePackage); - } - } - } - - return packs; - } - - static class ContentProviderImpl implements ITreeContentProvider { - - public void dispose() { - - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - - } - - public Object[] getElements(Object inputElement) { - return ((List<?>)inputElement).toArray(); - } - - public Object[] getChildren(Object parentElement) { - if( parentElement.getClass() == InternalPackage.class ) { - return ((InternalPackage)parentElement).classes.toArray(); - } else if( parentElement.getClass() == InternalClass.class ) { - return ((InternalClass)parentElement).features.toArray(); - } - return new Object[0]; - } - - public Object getParent(Object element) { - if( element.getClass() == InternalFeature.class ) { - return ((InternalFeature)element).clazz; - } else if( element.getClass() == InternalClass.class ) { - return ((InternalClass)element).pack; - } - return null; - } - - public boolean hasChildren(Object element) { - return getChildren(element).length > 0; - } - - } - - static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - private final Image packageImage; - private final Image classImage; - private final Image featureImage; - - public LabelProviderImpl(Image packageImage, Image classImage, Image featureImage) { - this.packageImage = packageImage; - this.classImage = classImage; - this.featureImage = featureImage; - } - - public void update(final ViewerCell cell) { - if( cell.getElement().getClass() == InternalPackage.class ) { - InternalPackage o = (InternalPackage) cell.getElement(); - StyledString styledString = new StyledString(o.ePackage.getName()); - styledString.append( " - " + o.ePackage.getNsURI(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setImage(packageImage); - } else if( cell.getElement().getClass() == InternalClass.class ) { - InternalClass o = (InternalClass) cell.getElement(); - cell.setText(o.eClass.getName()); - cell.setImage(classImage); - } else { - InternalFeature o = (InternalFeature) cell.getElement(); - StyledString styledString = new StyledString(o.feature.getName()); - - EClassifier type = ModelUtils.getTypeArgument(o.clazz.eClass, o.feature.getEGenericType()); - if( o.feature.isMany() ) { - styledString.append(" : List<" + type.getName()+ ">", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - styledString.append(" : " + type.getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } - - cell.setText(styledString.getString()); - cell.setStyleRanges(styledString.getStyleRanges()); - cell.setImage(featureImage); - } - } - - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - if( element.getClass() == InternalPackage.class ) { - InternalPackage o = (InternalPackage) element; - return o.ePackage.getName(); - } else if( element.getClass() == InternalClass.class ) { - InternalClass o = (InternalClass) element; - return o.eClass.getName(); - } else { - InternalFeature o = (InternalFeature) element; - return o.feature.getName(); - } - } - } - - static class ViewerFilterImpl extends ViewerFilter { - private StringMatcher matcher; - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) { - - if( element.getClass() == InternalPackage.class ) { - ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); - for( InternalClass c : ((InternalPackage)element).classes ) { - if( match(pv.getText(c)) ) { - return true; - } - } - return false; - } else if( element.getClass() == InternalPackage.class ) { - ILabelProvider pv = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); - return match(pv.getText(element)); - } - - return true; - } - - protected boolean wordMatches(String text) { - if (text == null) { - return false; - } - - //If the whole text matches we are all set - if(match(text)) { - return true; - } - - // Otherwise check if any of the words of the text matches - String[] words = getWords(text); - for (int i = 0; i < words.length; i++) { - String word = words[i]; - if (match(word)) { - return true; - } - } - - return false; - } - - /** - * Answers whether the given String matches the pattern. - * - * @param string the String to test - * - * @return whether the string matches the pattern - */ - private boolean match(String string) { - if (matcher == null) { - return true; - } - return matcher.match(string); - } - - /** - * The pattern string for which this filter should select - * elements in the viewer. - * - * @param patternString - */ - public void setPattern(String patternString) { - - if (patternString == null || patternString.equals("")) { //$NON-NLS-1$ - matcher = null; - } else { - String pattern = patternString + "*"; //$NON-NLS-1$ -// if (includeLeadingWildcard) { -// pattern = "*" + pattern; //$NON-NLS-1$ -// } - matcher = new StringMatcher(pattern, true, false); - } - } - - /** - * Take the given filter text and break it down into words using a - * BreakIterator. - * - * @param text - * @return an array of words - */ - private String[] getWords(String text){ - List<String> words = new ArrayList<String>(); - // Break the text up into words, separating based on whitespace and - // common punctuation. - // Previously used String.split(..., "\\W"), where "\W" is a regular - // expression (see the Javadoc for class Pattern). - // Need to avoid both String.split and regular expressions, in order to - // compile against JCL Foundation (bug 80053). - // Also need to do this in an NL-sensitive way. The use of BreakIterator - // was suggested in bug 90579. - BreakIterator iter = BreakIterator.getWordInstance(); - iter.setText(text); - int i = iter.first(); - while (i != java.text.BreakIterator.DONE && i < text.length()) { - int j = iter.following(i); - if (j == java.text.BreakIterator.DONE) { - j = text.length(); - } - // match the word - if (Character.isLetterOrDigit(text.charAt(i))) { - String word = text.substring(i, j); - words.add(word); - } - i = j; - } - return (String[]) words.toArray(new String[words.size()]); - } - } - - static class InternalPackage { - final EPackage ePackage; - List<InternalClass> classes = new ArrayList<InternalClass>(); - - public InternalPackage(EPackage ePackage) { - this.ePackage = ePackage; - } - - @Override - public String toString() { - return ePackage.toString(); - } - } - - static class InternalClass { - final InternalPackage pack; - final EClass eClass; - List<InternalFeature> features = new ArrayList<InternalFeature>(); - - public InternalClass(InternalPackage pack, EClass eClass) { - this.eClass = eClass; - this.pack = pack; - } - } - - static class InternalFeature { - final InternalClass clazz; - final EStructuralFeature feature; - - public InternalFeature(InternalClass clazz, EStructuralFeature feature) { - this.clazz = clazz; - this.feature = feature; - } - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java deleted file mode 100644 index 9a508b92..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.e4.ui.model.application.MApplication; - -import org.eclipse.swt.widgets.Button; - -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Label; - -import org.eclipse.swt.layout.GridData; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.TitleAreaDialog; - -public class FindImportElementDialog extends TitleAreaDialog { - private MApplication runningApp; - - public FindImportElementDialog(Shell parentShell, EditingDomain domain, EObject element/*, MApplication runningApp*/) { - super(parentShell); - this.runningApp = runningApp; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); - setTitleImage(titleImage); - getShell().addDisposeListener(new DisposeListener() { - - public void widgetDisposed(DisposeEvent e) { - titleImage.dispose(); - } - }); - - getShell().setText("Find Import Elements"); - setTitle("Find Import Elements"); - setMessage("Search for an elements whose ID you'd like to import"); - - Composite container = new Composite(comp,SWT.NONE); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - container.setLayout(new GridLayout(3, false)); - - - Label l = new Label(container, SWT.NONE); - l.setText("Search"); - - final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - searchText.setLayoutData(gd); - - new Label(container, SWT.NONE); - - l = new Label(container, SWT.NONE); - l.setText("File"); - - Text t = new Text(container, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - t.setText("memory://running-model"); - - Button b = new Button(container, SWT.PUSH); - b.setText("Browse"); - - l = new Label(container, SWT.PUSH); - - TableViewer viewer = new TableViewer(container); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - return comp; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java deleted file mode 100644 index 39f72ebd..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { - private MHandledItem handler; - - public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { - super(parentShell, resource); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return "MenuItem Command"; - } - - @Override - protected String getDialogTitle() { - return "MenuItem-Command"; - } - - @Override - protected String getDialogMessage() { - return "Connect the MenuItem to a command"; - } - - @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java deleted file mode 100644 index 8f9b0345..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem; -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { - private MHandledItem handler; - - public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource) { - super(parentShell, resource); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return "ToolItem Command"; - } - - @Override - protected String getDialogTitle() { - return "ToolItem-Command"; - } - - @Override - protected String getDialogMessage() { - return "Connect the ToolItem to a command"; - } - - @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java deleted file mode 100644 index ace3d857..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { - private MHandler handler; - - public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource) { - super(parentShell, resource); - this.handler = handler; - } - - @Override - protected String getShellTitle() { - return "Handler Command"; - } - - @Override - protected String getDialogTitle() { - return "Handler-Command"; - } - - @Override - protected String getDialogMessage() { - return "Connect the handler to a command"; - } - - @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, handler, CommandsPackageImpl.Literals.HANDLER__COMMAND, command); - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java deleted file mode 100644 index bda337ad..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/KeyBindingCommandSelectionDialog.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MKeyBinding; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class KeyBindingCommandSelectionDialog extends AbstractCommandSelectionDialog { - private MKeyBinding binding; - - public KeyBindingCommandSelectionDialog(Shell parentShell, MKeyBinding binding, IModelResource resource) { - super(parentShell, resource); - this.binding = binding; - } - - @Override - protected String getShellTitle() { - return "Keybinding Command"; - } - - @Override - protected String getDialogTitle() { - return "Keybinding-Command"; - } - - @Override - protected String getDialogMessage() { - return "Connect the keybinding to a command"; - } - - @Override - protected Command createStoreCommand( EditingDomain editingDomain, MCommand command) { - return SetCommand.create(editingDomain, binding, CommandsPackageImpl.Literals.KEY_BINDING__COMMAND, command); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java deleted file mode 100644 index 704470cc..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class MenuIconDialogEditor extends AbstractIconDialog { - - public MenuIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenu element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Menu Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Menu Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java deleted file mode 100644 index b35362f4..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/MenuItemIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuItem; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class MenuItemIconDialogEditor extends AbstractIconDialog { - - public MenuItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MMenuItem element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Menu Item Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Menu Item Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java deleted file mode 100644 index 165cb83a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartDescriptorIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PartDescriptorIconDialogEditor extends AbstractIconDialog { - - public PartDescriptorIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPartDescriptor element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Part Descriptor Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Part Descriptor Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java deleted file mode 100644 index d2c0e3f8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PartIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MPart; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PartIconDialogEditor extends AbstractIconDialog { - - public PartIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPart element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Part Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Part Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java deleted file mode 100644 index fecfb283..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/PerspectiveIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class PerspectiveIconDialogEditor extends AbstractIconDialog { - - public PerspectiveIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MPerspective element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Perspective Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Perspective Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java deleted file mode 100644 index f843431f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ /dev/null @@ -1,234 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; - -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; - -import org.eclipse.emf.edit.command.SetCommand; - -import org.eclipse.emf.common.command.Command; - -import org.eclipse.jface.viewers.IStructuredSelection; - -import org.eclipse.e4.tools.emf.ui.common.IModelResource; - -import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder; - -import org.eclipse.e4.tools.emf.ui.internal.PatternFilter; -import org.eclipse.jface.viewers.AbstractTreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; - -import org.eclipse.jface.viewers.StyledString; - -import org.eclipse.e4.ui.model.application.ui.MUILabel; - -import org.eclipse.swt.graphics.Image; - -import org.eclipse.jface.viewers.ViewerCell; - -import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer; - -import org.eclipse.e4.ui.model.application.ui.basic.MPart; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.StyledCellLabelProvider; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.ui.model.fragment.MModelFragment; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.application.ui.MUIElement; - -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; - -import java.util.ArrayList; - -import java.util.List; - -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.e4.ui.model.application.MApplicationElement; - -import org.eclipse.e4.ui.model.application.MApplication; - -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; - -import org.eclipse.jface.viewers.ArrayContentProvider; - -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.swt.layout.GridData; - -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Text; - -import org.eclipse.swt.SWT; - -import org.eclipse.swt.widgets.Label; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -import org.eclipse.swt.widgets.Shell; - -import org.eclipse.jface.dialogs.TitleAreaDialog; - -public class SharedElementsDialog extends TitleAreaDialog { - private TableViewer viewer; - private MPlaceholder placeholder; - private IModelResource resource; - private ModelEditor editor; - - public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, IModelResource resource) { - super(parentShell); - this.editor = editor; - this.placeholder = placeholder; - this.resource = resource; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); - - setTitle("Find Shared Elements"); - setMessage("Find Shared Elements of an Window"); - - - Composite container = new Composite(comp, SWT.NONE); - container.setLayout(new GridLayout(2, false)); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - - Label l = new Label(container, SWT.NONE); - l.setText("Name"); - - Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); - searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - l = new Label(container, SWT.NONE); - - viewer = new TableViewer(container); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new LabelProviderImpl()); - viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - - viewer.addDoubleClickListener(new IDoubleClickListener() { - - public void doubleClick(DoubleClickEvent event) { - okPressed(); - } - }); - - if( resource.getRoot().get(0) instanceof MApplication ) { - List<MUIElement> list = new ArrayList<MUIElement>(); - for( MWindow m : ((MApplication)resource.getRoot().get(0)).getChildren() ) { - list.addAll(filter(m.getSharedElements())); - } - viewer.setInput(list); - } else if( resource.getRoot().get(0) instanceof MModelFragments ) { - List<MApplicationElement> list = new ArrayList<MApplicationElement>(); - for( MModelFragment f : ((MModelFragments)resource.getRoot().get(0)).getFragments() ) { - if( f instanceof MStringModelFragment ) { - if( ((MStringModelFragment)f).getFeaturename().equals("sharedElements") ) { //$NON-NLS-1$ - list.addAll(filter(f.getElements())); - } - } - } - viewer.setInput(list); - } - - final PatternFilter filter = new PatternFilter() { - @Override - protected boolean isParentMatch(Viewer viewer, Object element) { - return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); - } - }; - viewer.addFilter(filter); - - searchText.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - filter.setPattern(((Text) e.widget).getText()); - viewer.refresh(); - } - }); - - return comp; - } - - @Override - protected void okPressed() { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); - if( cmd.canExecute() ) { - resource.getEditingDomain().getCommandStack().execute(cmd); - super.okPressed(); - } - } - } - - private static <T> List<T> filter(List<T> o) { - List<T> rv = new ArrayList<T>(); - for( T i : o ) { - if( i instanceof MPart || i instanceof MPartSashContainer ) { - rv.add(i); - } - } - return rv; - } - - private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { - public void update(final ViewerCell cell) { - EObject o = (EObject) cell.getElement(); - - StyledString string = new StyledString(getTypename(o)); - - if( o instanceof MUILabel ) { - string.append(" - " + ((MUILabel)o).getLabel(), StyledString.DECORATIONS_STYLER); - } - - MApplicationElement el = (MApplicationElement) o; - string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); - - cell.setText(string.getString()); - cell.setStyleRanges(string.getStyleRanges()); - cell.setImage(getImage(o)); - } - - public String getText(Object element) { - EObject o = (EObject) element; - MApplicationElement el = (MApplicationElement) o; - - if( el instanceof MUILabel ) { - MUILabel label = (MUILabel) el; - return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); - } else { - return getTypename(o) + " - " + el.getElementId() + " - "; - } - } - - private String getTypename(EObject o) { - AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor((o).eClass()); - if( editor != null ) { - return editor.getLabel(o); - } else { - return o.eClass().getName(); - } - } - - public Image getImage(Object element) { - AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject)element).eClass()); - if( editor != null ) { - return editor.getImage(element, getShell().getDisplay()); - } - return null; - } - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java deleted file mode 100644 index d11e1b31..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ToolItemIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MToolItem; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class ToolItemIconDialogEditor extends AbstractIconDialog { - - public ToolItemIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MToolItem element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "ToolItem Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "ToolItem Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java deleted file mode 100644 index af108df5..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/WindowIconDialogEditor.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.swt.widgets.Shell; - -public class WindowIconDialogEditor extends AbstractIconDialog { - - public WindowIconDialogEditor(Shell parentShell, IProject project, EditingDomain editingDomain, MWindow element) { - super(parentShell, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI); - } - - @Override - protected String getShellTitle() { - return "Menu Icon Search"; - } - - @Override - protected String getDialogTitle() { - return "Menu Icon Search"; - } - - @Override - protected String getDialogMessage() { - return "Search for GIF, PNG and JPG icons in the current project"; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java deleted file mode 100644 index 5b4a622e..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java +++ /dev/null @@ -1,219 +0,0 @@ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.tools.emf.ui.internal.common.commands.AddAddonCommand; -import org.eclipse.e4.tools.emf.ui.internal.common.commands.RemoveAddonCommand; -import org.eclipse.e4.ui.model.application.MAddon; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VApplicationAddons extends AbstractComponentEditor { - private Composite composite; - private TableViewer viewer; - private EMFDataBindingContext context; - - private List<Action> actions = new ArrayList<Action>(); - - //FIXME We need to plug this stuff into the command frameworks - private AddAddonCommand addAddonCommand = new AddAddonCommand(); - private RemoveAddonCommand removeAddonCommand = new RemoveAddonCommand(); - - public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - actions.add(new Action("Add Addon") { - @Override - public void run() { - handleAddAddon(); - } - }); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Addons"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Addons bla bla bla bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Commands"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__ADDONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - handleAddAddon(); - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - handleRemoveAddons(((IStructuredSelection)viewer.getSelection()).toList()); - } - } - }); - } - - return parent; - } - - private void handleAddAddon() { - addAddonCommand.execute(getEditingDomain(), (MApplication) getMaster().getValue()); - } - - private void handleRemoveAddons(List<MAddon> addons) { - removeAddonCommand.execute(getEditingDomain(), addons); - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - - @Override - public List<Action> getActions(Object element) { - ArrayList<Action> l = new ArrayList<Action>(super.getActions(element)); - l.addAll(actions); - return l; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java deleted file mode 100644 index aec316a1..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java +++ /dev/null @@ -1,492 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.databinding.observable.IObservable; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.list.WritableList; -import org.eclipse.core.databinding.observable.masterdetail.IObservableFactory; -import org.eclipse.core.databinding.observable.value.IObservableValue; -import org.eclipse.core.databinding.observable.value.IValueChangeListener; -import org.eclipse.core.databinding.observable.value.ValueChangeEvent; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.Messages; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MBindingContext; -import org.eclipse.e4.ui.model.application.commands.MBindingTable; -import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.emf.databinding.IEMFValueProperty; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider; -import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.jface.viewers.ColumnViewerEditor; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; -import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; -import org.eclipse.jface.viewers.EditingSupport; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TextCellEditor; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.TreeViewerColumn; -import org.eclipse.jface.viewers.TreeViewerEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VBindingTableEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer bindingViewer; - private TreeViewer contextsViewer; - - public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return Messages.VBindingTableEditor_Label; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return Messages.VBindingTableEditor_Description; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - bindingViewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText(Messages.VBindingTableEditor_Contexts); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - contextsViewer = new TreeViewer(parent); - ObservableListTreeContentProvider pv = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisorImpl()); - contextsViewer.setContentProvider(pv); - contextsViewer.getTree().setHeaderVisible(true); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - contextsViewer.getControl().setLayoutData(gd); - - final WritableList list = new WritableList(); - - IEMFValueProperty listProp = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT); - IObservableValue val = listProp.observeDetail(getMaster()); - val.addValueChangeListener(new IValueChangeListener() { - - public void handleValueChange(ValueChangeEvent event) { - list.clear(); - MBindingContext ctx = (MBindingContext) event.getObservableValue().getValue(); - if( ctx != null ) { - list.add(ctx); - } - } - }); - - - contextsViewer.setInput(list); - - - { - IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_Name); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MBindingContext>(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getName() != null ? ctx.getName() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFProperties.value(CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_LabelDescription); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MBindingContext>(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, CommandsPackageImpl.Literals.BINDING_CONTEXT__DESCRIPTION, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getDescription() != null ? ctx.getDescription() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - { - IEMFValueProperty prop = EMFProperties.value(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TreeViewerColumn column = new TreeViewerColumn(contextsViewer, SWT.NONE); - column.getColumn().setText(Messages.VBindingTableEditor_Id); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MBindingContext>(prop.observeDetail(pv.getKnownElements()))); - column.setEditingSupport(new EditingSupport(contextsViewer) { - private TextCellEditor editor = new TextCellEditor(contextsViewer.getTree()); - - @Override - protected void setValue(Object element, Object value) { - Command cmd = SetCommand.create(getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, value); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - - @Override - protected Object getValue(Object element) { - MBindingContext ctx = (MBindingContext) element; - return ctx.getElementId() != null ? ctx.getElementId() : ""; //$NON-NLS-1$ - } - - @Override - protected CellEditor getCellEditor(Object element) { - return editor; - } - - @Override - protected boolean canEdit(Object element) { - return true; - } - }); - } - - ColumnViewerEditorActivationStrategy editorActivationStrategy = new ColumnViewerEditorActivationStrategy(contextsViewer) { - @Override - protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { - boolean singleSelect = ((IStructuredSelection)contextsViewer.getSelection()).size() == 1; - boolean isLeftDoubleMouseSelect = event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION && ((MouseEvent)event.sourceEvent).button == 1; - - return singleSelect && (isLeftDoubleMouseSelect - || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC - || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL); - } - }; - TreeViewerEditor.create(contextsViewer, editorActivationStrategy, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | ColumnViewerEditor.KEEP_EDITOR_ON_DOUBLE_CLICK); - - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Up); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Down); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Add); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); - MBindingContext context = MCommandsFactory.INSTANCE.createBindingContext(); - MBindingContext parentContext = null; - - if( ! s.isEmpty() ) { - parentContext = (MBindingContext) s.getFirstElement(); - Command cmd = AddCommand.create(getEditingDomain(), parentContext, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, context); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - contextsViewer.setSelection(new StructuredSelection(context)); - } - } else if( s.isEmpty() && ((MBindingTableContainer)getMaster().getValue()).getRootContext() == null ) { - Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, context); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - contextsViewer.setSelection(new StructuredSelection(context)); - } - } - - - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText(Messages.VBindingTableEditor_Remove); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - IStructuredSelection s = (IStructuredSelection) contextsViewer.getSelection(); - if( ! s.isEmpty() ) { - List<Command> commands = new ArrayList<Command>(); - - for( Object o : s.toArray() ) { - MBindingContext ctx = (MBindingContext) o; - EObject owner = ((EObject)ctx).eContainer(); - if( owner instanceof MBindingTableContainer ) { - Command cmd = SetCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__ROOT_CONTEXT, null); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - return; - } - } else { - commands.add(RemoveCommand.create(getEditingDomain(), owner, CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN, ctx)); - } - } - - CompoundCommand cmd = new CompoundCommand(commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Binding Tables"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - bindingViewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - bindingViewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 180; - bindingViewer.getControl().setLayoutData(gd); - bindingViewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!bindingViewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindingTableContainer container = (MBindingTableContainer) getMaster().getValue(); - int idx = container.getBindingTables().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - bindingViewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!bindingViewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) bindingViewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MBindingTableContainer container = (MBindingTableContainer) getMaster().getValue(); - int idx = container.getBindingTables().indexOf(obj) + 1; - if (idx < container.getBindingTables().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - bindingViewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!bindingViewer.getSelection().isEmpty()) { - List<?> commands = ((IStructuredSelection) bindingViewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, commands); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - - private static class ObservableFactoryImpl implements IObservableFactory { - private IEMFListProperty prop = EMFProperties.list(CommandsPackageImpl.Literals.BINDING_CONTEXT__CHILDREN); - - public IObservable createObservable(Object target) { - if( target instanceof IObservableList ) { - return (IObservable) target; - } - return prop.observe(target); - } - } - - private static class TreeStructureAdvisorImpl extends TreeStructureAdvisor { - - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java deleted file mode 100644 index 156bdd2a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.MApplication; -import org.eclipse.e4.ui.model.application.commands.MCommand; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsFactoryImpl; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VCommandEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - private EStructuralFeature commandsFeature; - - public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) { - super(editingDomain,editor); - this.commandsFeature = commandsFeature; - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Commands"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Commands Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Commands"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MApplication container = (MApplication) getMaster().getValue(); - int idx = container.getCommands().indexOf(obj) + 1; - if( idx < container.getCommands().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java deleted file mode 100644 index 9744229f..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MCommandsFactory; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.commands.MHandlerContainer; -import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.FeaturePath; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VHandlerEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Handlers"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Handlers Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Handlers"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), FeaturePath.fromList(CommandsPackageImpl.Literals.HANDLER__COMMAND, CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME)); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Command"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Class"); - column.getColumn().setWidth(300); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(150); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); - int idx = container.getHandlers().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MHandlerContainer container = (MHandlerContainer) getMaster().getValue(); - int idx = container.getHandlers().indexOf(obj) + 1; - if( idx < container.getHandlers().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MHandler handler = MCommandsFactory.INSTANCE.createHandler(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> handlers = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handlers); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java deleted file mode 100644 index 54a03e5c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VMenuContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Menu Contributions"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Menu Contributions Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Menu Contributions"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MMenuContributions container = (MMenuContributions) getMaster().getValue(); - int idx = container.getMenuContributions().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MMenuContributions container = (MMenuContributions) getMaster().getValue(); - int idx = container.getMenuContributions().indexOf(obj) + 1; - if( idx < container.getMenuContributions().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java deleted file mode 100644 index 6a187c8c..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.menu.MMenu; -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VMenuEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - private EStructuralFeature feature; - - public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) { - super(editingDomain,editor); - this.feature = feature; - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Menus"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Menus Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - Label l = new Label(parent, SWT.NONE); - l.setText("Menus"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - viewer.setLabelProvider(new ObservableColumnLabelProvider<MMenu>(valProp.observeDetail(cp.getKnownElements()))); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MMenu handler = MMenuFactory.INSTANCE.createMenu(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> windows = ((IStructuredSelection) viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__MENUS, windows); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java deleted file mode 100644 index 22c35191..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelFragmentsEditor.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VModelFragmentsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VModelFragmentsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Fragments"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Fragments Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Fragments"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getFragments().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getFragments().indexOf(obj) + 1; - if( idx < container.getFragments().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - - MStringModelFragment eObject = MFragmentFactory.INSTANCE.createStringModelFragment(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, eObject); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> elements = ((IStructuredSelection)viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, elements); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java deleted file mode 100644 index 41522907..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VModelImportsEditor.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EPackage; - -import java.util.ArrayList; -import org.eclipse.e4.tools.emf.ui.common.IEditorFeature.FeatureClass; -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; -import org.eclipse.emf.databinding.EMFProperties; -import org.eclipse.emf.databinding.IEMFListProperty; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; - -import org.eclipse.e4.ui.model.fragment.MModelFragments; - -import org.eclipse.e4.ui.model.fragment.impl.FragmentPackageImpl; - -import org.eclipse.e4.ui.model.fragment.MStringModelFragment; - -import org.eclipse.e4.ui.model.fragment.MFragmentFactory; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VModelImportsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VModelImportsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Imports"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Imports Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Imports"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - viewer.setContentProvider(new ObservableListContentProvider()); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 200; - viewer.getControl().setLayoutData(gd); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2, false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getImports().indexOf(obj) - 1; - if (idx >= 0) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - if (s.size() == 1) { - Object obj = s.getFirstElement(); - MModelFragments container = (MModelFragments) getMaster().getValue(); - int idx = container.getImports().indexOf(obj) + 1; - if (idx < container.getImports().size()) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, obj, idx); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - FeatureClass eclass = (FeatureClass) element; - return eclass.label; - } - }); - childrenDropDown.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - FeatureClass eClass1 = (FeatureClass) e1; - FeatureClass eClass2 = (FeatureClass) e2; - return eClass1.label.compareTo(eClass2.label); - } - }); - - List<FeatureClass> list = new ArrayList<FeatureClass>(); - addClasses(ApplicationPackageImpl.eINSTANCE, list); - list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS)); - - childrenDropDown.setInput(list); - childrenDropDown.getCombo().select(0); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = ((FeatureClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement()).eClass; - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> elements = ((IStructuredSelection) viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, elements); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - public void addClasses(EPackage ePackage, List<FeatureClass> list) { - for (EClassifier c : ePackage.getEClassifiers()) { - if (c instanceof EClass) { - EClass eclass = (EClass) c; - if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) { - list.add(new FeatureClass(eclass.getName(), eclass)); - } - } - } - - for (EPackage eSubPackage : ePackage.getESubpackages()) { - addClasses(eSubPackage, list); - } - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java deleted file mode 100644 index aac36fea..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VPartDescriptor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Part Descriptors"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Part Descriptors Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Descriptors"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART_DESCRIPTOR__CATEGORY); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Category"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); - int idx = container.getDescriptors().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MPartDescriptorContainer container = (MPartDescriptorContainer) getMaster().getValue(); - int idx = container.getDescriptors().indexOf(obj) + 1; - if( idx < container.getDescriptors().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java deleted file mode 100644 index e1edb402..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VToolBarContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain, editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "ToolBar Contributions"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "ToolBar Contributions Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("ToolBar Contributions"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); - int idx = container.getToolBarContributions().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MToolBarContributions container = (MToolBarContributions) getMaster().getValue(); - int idx = container.getToolBarContributions().indexOf(obj) + 1; - if( idx < container.getToolBarContributions().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java deleted file mode 100644 index 42b3bd4a..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MTrimContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.MToolBarContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContributions; - -import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution; - -import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl; - -import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.commands.MHandler; -import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor; -import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer; -import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VTrimContributionsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Trim Contributions"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Trim Contributions Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Trim Contributions"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Id"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__PARENT_ID); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("ParentId"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty prop = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Position"); - column.getColumn().setWidth(200); - column.setLabelProvider(new ObservableColumnLabelProvider<MHandler>(prop.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MTrimContributions container = (MTrimContributions) getMaster().getValue(); - int idx = container.getTrimContributions().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MTrimContributions container = (MTrimContributions) getMaster().getValue(); - int idx = container.getTrimContributions().indexOf(obj) + 1; - if( idx < container.getTrimContributions().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add ..."); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(command); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> commands = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, commands); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java deleted file mode 100644 index 12ce25b8..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VWindowControlEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Controls"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Controls Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { - AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART_STACK, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART - }); - childrenDropDown.setSelection(new StructuredSelection(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> elements = ((IStructuredSelection)viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, elements); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java deleted file mode 100644 index 3f358ad0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.ObservableColumnLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.basic.MWindow; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditValueProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.TableViewerColumn; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VWindowEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Windows"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Windows Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if (composite == null) { - context = new EMFDataBindingContext(); - composite = createForm(parent, context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>) object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master) { - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - Label l = new Label(parent, SWT.NONE); - l.setText("Windows"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - viewer.getTable().setHeaderVisible(true); - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Name"); - column.getColumn().setWidth(180); - column.setLabelProvider(new ObservableColumnLabelProvider<MWindow>(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("X"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider<MWindow>(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Y"); - column.getColumn().setWidth(80); - column.setLabelProvider(new ObservableColumnLabelProvider<MWindow>(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Width"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MWindow>(valProp.observeDetail(cp.getKnownElements()))); - } - - { - IEMFEditValueProperty valProp = EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT); - - TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); - column.getColumn().setText("Height"); - column.getColumn().setWidth(100); - column.setLabelProvider(new ObservableColumnLabelProvider<MWindow>(valProp.observeDetail(cp.getKnownElements()))); - } - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL, GridData.END, false, false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft = 0; - gl.marginRight = 0; - gl.marginWidth = 0; - gl.marginHeight = 0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.TRIMMED_WINDOW }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - EObject handler = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler); - - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (!viewer.getSelection().isEmpty()) { - List<?> windows = ((IStructuredSelection) viewer.getSelection()).toList(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - Command cmd = RemoveCommand.create(getEditingDomain(), container, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, windows); - if (cmd.canExecute()) { - getEditingDomain().getCommandStack().execute(cmd); - if( container.getChildren().size() > 0 ) { - viewer.setSelection(new StructuredSelection(container.getChildren().get(0))); - } - } - } - } - }); - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java deleted file mode 100644 index 253f4fe0..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.ui.model.application.ui.MElementContainer; -import org.eclipse.e4.ui.model.application.ui.advanced.impl.AdvancedPackageImpl; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.edit.EMFEditProperties; -import org.eclipse.emf.databinding.edit.IEMFEditListProperty; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.MoveCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; - -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.jface.viewers.TableViewer; - -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; - -import org.eclipse.emf.edit.domain.EditingDomain; - -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; - -public class VWindowSharedElementsEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Shared Elements"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Shared Elements Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - - IEMFEditListProperty prop = EMFEditProperties.list(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS); - viewer.setInput(prop.observeDetail(getMaster())); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(2,false); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Up"); - b.setImage(getImage(b.getDisplay(), ARROW_UP)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) - 1; - if( idx >= 0 ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Down"); - b.setImage(getImage(b.getDisplay(), ARROW_DOWN)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - IStructuredSelection s = (IStructuredSelection)viewer.getSelection(); - if( s.size() == 1 ) { - Object obj = s.getFirstElement(); - MElementContainer<?> container = (MElementContainer<?>) getMaster().getValue(); - int idx = container.getChildren().indexOf(obj) + 1; - if( idx < container.getChildren().size() ) { - Command cmd = MoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, obj, idx); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - viewer.setSelection(new StructuredSelection(obj)); - } - } - - } - } - } - }); - - final ComboViewer childrenDropDown = new ComboViewer(buttonComp); - childrenDropDown.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - childrenDropDown.setContentProvider(new ArrayContentProvider()); - childrenDropDown.setLabelProvider(new LabelProvider() { - @Override - public String getText(Object element) { - EClass eclass = (EClass) element; - return eclass.getName(); - } - }); - childrenDropDown.setInput(new EClass[] { - BasicPackageImpl.Literals.PART_SASH_CONTAINER, - BasicPackageImpl.Literals.PART, - BasicPackageImpl.Literals.INPUT_PART - }); - childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.PART)); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! childrenDropDown.getSelection().isEmpty() ) { - EClass eClass = (EClass) ((IStructuredSelection)childrenDropDown.getSelection()).getFirstElement(); - - EObject eObject = EcoreUtil.create(eClass); - - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(eObject); - } - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false,2,1)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> elements = ((IStructuredSelection)viewer.getSelection()).toList(); - - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, elements); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java deleted file mode 100644 index 1d7ea115..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual; - -import java.util.List; -import org.eclipse.core.databinding.observable.list.IObservableList; -import org.eclipse.core.databinding.observable.value.WritableValue; -import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.ComponentLabelProvider; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.e4.tools.emf.ui.internal.common.VirtualEntry; -import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory; -import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar; -import org.eclipse.e4.ui.model.application.ui.basic.impl.BasicPackageImpl; -import org.eclipse.emf.common.command.Command; -import org.eclipse.emf.databinding.EMFDataBindingContext; -import org.eclipse.emf.edit.command.AddCommand; -import org.eclipse.emf.edit.command.RemoveCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; - -public class VWindowTrimEditor extends AbstractComponentEditor { - private Composite composite; - private EMFDataBindingContext context; - private TableViewer viewer; - - public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) { - super(editingDomain,editor); - } - - @Override - public Image getImage(Object element, Display display) { - return null; - } - - @Override - public String getLabel(Object element) { - return "Window Trims"; - } - - @Override - public String getDetailLabel(Object element) { - return null; - } - - @Override - public String getDescription(Object element) { - return "Window Trims Bla Bla Bla Bla Bla"; - } - - @Override - public Composite getEditor(Composite parent, Object object) { - if( composite == null ) { - context = new EMFDataBindingContext(); - composite = createForm(parent,context, getMaster()); - } - VirtualEntry<?> o = (VirtualEntry<?>)object; - viewer.setInput(o.getList()); - getMaster().setValue(o.getOriginalParent()); - return composite; - } - - private Composite createForm(Composite parent, EMFDataBindingContext context, - WritableValue master) { - parent = new Composite(parent,SWT.NONE); - parent.setLayout(new GridLayout(3, false)); - - { - Label l = new Label(parent, SWT.NONE); - l.setText("Controls"); - l.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); - - viewer = new TableViewer(parent); - ObservableListContentProvider cp = new ObservableListContentProvider(); - viewer.setContentProvider(cp); - viewer.setLabelProvider(new ComponentLabelProvider(getEditor())); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 300; - viewer.getControl().setLayoutData(gd); - - Composite buttonComp = new Composite(parent, SWT.NONE); - buttonComp.setLayoutData(new GridData(GridData.FILL,GridData.END,false,false)); - GridLayout gl = new GridLayout(); - gl.marginLeft=0; - gl.marginRight=0; - gl.marginWidth=0; - gl.marginHeight=0; - buttonComp.setLayout(gl); - - Button b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Add Trim"); - b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar(); - Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler); - - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - getEditor().setSelection(handler); - } - } - }); - - b = new Button(buttonComp, SWT.PUSH | SWT.FLAT); - b.setText("Remove"); - b.setImage(getImage(b.getDisplay(), TABLE_DELETE_IMAGE)); - b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if( ! viewer.getSelection().isEmpty() ) { - List<?> trimElements = ((IStructuredSelection)viewer.getSelection()).toList(); - Command cmd = RemoveCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, trimElements); - if( cmd.canExecute() ) { - getEditingDomain().getCommandStack().execute(cmd); - } - } - } - }); - } - - return parent; - } - - @Override - public IObservableList getChildList(Object element) { - // TODO Auto-generated method stub - return null; - } - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java deleted file mode 100644 index c406dfc6..00000000 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/wbm/ApplicationModelEditor.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 BestSolution.at and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - ******************************************************************************/ -package org.eclipse.e4.tools.emf.ui.internal.wbm; - -import javax.inject.Named; - -import javax.inject.Inject; -import org.eclipse.core.resources.IProject; -import org.eclipse.e4.core.contexts.IEclipseContext; -import org.eclipse.e4.core.di.annotations.Optional; -import org.eclipse.e4.tools.emf.ui.common.IModelResource; -import org.eclipse.e4.tools.emf.ui.internal.common.ModelEditor; -import org.eclipse.swt.widgets.Composite; - -public class ApplicationModelEditor extends ModelEditor { - @Inject - public ApplicationModelEditor(Composite composite, IEclipseContext context, - IModelResource modelProvider, @Named("org.eclipse.e4.tools.emf.ui.editorproject") @Optional IProject project) { - super(composite, context, modelProvider, project); - } -} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.classpath b/bundles/org.eclipse.e4.tools.jdt.templates/.classpath deleted file mode 100644 index 64c5e31b..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.classpath +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.project b/bundles/org.eclipse.e4.tools.jdt.templates/.project deleted file mode 100644 index e0303cd3..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.project +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.tools.jdt.templates</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5a797383..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Sat Mar 06 23:33:15 EST 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF deleted file mode 100644 index 1a967cb3..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: e4 Templates -Bundle-SymbolicName: org.eclipse.e4.tools.jdt.templates;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.jdt.ui;bundle-version="3.6.0", - org.eclipse.ui.editors;bundle-version="3.6.0", - org.eclipse.jface.text;bundle-version="3.6.0", - org.eclipse.jdt.core;bundle-version="3.6.0", - org.eclipse.core.runtime;bundle-version="3.6.0" -Export-Package: org.eclipse.e4.internal.tools.jdt.templates diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/build.properties b/bundles/org.eclipse.e4.tools.jdt.templates/build.properties deleted file mode 100644 index 3337a4a3..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - templates/,\ - icons/ diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif b/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif Binary files differdeleted file mode 100644 index 150a1f7e..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/icons/full/elcl16/e4assist_co.gif +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml b/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml deleted file mode 100644 index b3ed8606..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/plugin.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="e4ProposalCategory" - name="e4 proposals"> - <proposalCategory - icon="$nl$/icons/full/elcl16/e4assist_co.gif"/> - </extension> - <extension - point="org.eclipse.jdt.ui.javaCompletionProposalComputer" - id="e4BuilderCompletionProposalComputer"> - <javaCompletionProposalComputer - activate="true" - categoryId="org.eclipse.e4.tools.jdt.templates.e4ProposalCategory" - class="org.eclipse.e4.internal.tools.jdt.templates.E4TemplateCompletionProposalComputer"> - <partition type="__dftl_partition_content_type"/> - </javaCompletionProposalComputer> - </extension> - <extension - point="org.eclipse.ui.editors.templates"> - <contextType - name="e4" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <contextType - name="e4 statements" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4-statements" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <contextType - name="e4 members" - class="org.eclipse.e4.internal.tools.jdt.templates.E4ContextType" - id="e4-members" - registryId="org.eclipse.jdt.ui.CompilationUnitEditor"> - </contextType> - <include - file="templates/default-e4templates.xml" - translations="$nl$/templates/default-e4templates.properties"> - </include> - </extension> - -</plugin> diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java deleted file mode 100644 index 1fdf5ff9..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4ContextType.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation (adapted from JDT's SWTContextType) - *******************************************************************************/ -package org.eclipse.e4.internal.tools.jdt.templates; - -import org.eclipse.jdt.internal.corext.template.java.AbstractJavaContextType; -import org.eclipse.jdt.internal.corext.template.java.JavaContext; - -/** - * The context type for templates inside e4 code. - * The same class is used for several context types: - * <dl> - * <li>templates for all Java code locations</li> - * <li>templates for member locations</li> - * <li>templates for statement locations</li> - * </dl> - */ -public class E4ContextType extends AbstractJavaContextType { - - /** - * The context type id for templates working on all Java code locations in e4 projects - */ - public static final String ID_ALL= "e4"; //$NON-NLS-1$ - - /** - * The context type id for templates working on member locations in e4 projects - */ - public static final String ID_MEMBERS= "e4-members"; //$NON-NLS-1$ - - /** - * The context type id for templates working on statement locations in e4 projects - */ - public static final String ID_STATEMENTS= "e4-statements"; //$NON-NLS-1$ - - protected void initializeContext(JavaContext context) { - if (!getId().equals(E4ContextType.ID_ALL)) { // a specific context must also allow the templates that work everywhere - context.addCompatibleContextType(E4ContextType.ID_ALL); - } - } -} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java b/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java deleted file mode 100644 index cadf6bfc..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/src/org/eclipse/e4/internal/tools/jdt/templates/E4TemplateCompletionProposalComputer.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation (adapted from JDT's SWTTemplateCompletionProposalComputer) - *******************************************************************************/ -package org.eclipse.e4.internal.tools.jdt.templates; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jdt.core.CompletionContext; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.JavaPlugin; -import org.eclipse.jdt.internal.ui.text.java.AbstractTemplateCompletionProposalComputer; -import org.eclipse.jdt.internal.ui.text.template.contentassist.TemplateEngine; -import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext; -import org.eclipse.jface.text.templates.ContextTypeRegistry; -import org.eclipse.jface.text.templates.TemplateContextType; - -/** - * Computer that computes the template proposals for the E4 context type. - * - */ -public class E4TemplateCompletionProposalComputer extends AbstractTemplateCompletionProposalComputer { - - /** - * The name of <code>org.eclipse.e4.core.services.IDisposable</code> used to detect - * if a project uses e4. - */ - private static final String E4_TYPE_NAME= "org.eclipse.e4.core.services.IDisposable"; //$NON-NLS-1$ - - - /** - * Listener that resets the cached java project if its build path changes. - */ - private final class BuildPathChangeListener implements IElementChangedListener { - - public void elementChanged(ElementChangedEvent event) { - IJavaProject javaProject= getCachedJavaProject(); - if (javaProject == null) - return; - - IJavaElementDelta[] children= event.getDelta().getChangedChildren(); - for (int i= 0; i < children.length; i++) { - IJavaElementDelta child= children[i]; - if (javaProject.equals(child.getElement())) { - if (isClasspathChange(child)) { - setCachedJavaProject(null); - } - } - } - } - - /** - * Does the delta indicate a classpath change? - * @param delta the delta to inspect - * @return true if classpath has changed - */ - private boolean isClasspathChange(IJavaElementDelta delta) { - int flags= delta.getFlags(); - if (isClasspathChangeFlag(flags)) - return true; - - if ((flags & IJavaElementDelta.F_CHILDREN) != 0) { - IJavaElementDelta[] children= delta.getAffectedChildren(); - for (int i= 0; i < children.length; i++) { - if (isClasspathChangeFlag(children[i].getFlags())) - return true; - } - } - - return false; - } - - /** - * Do the flags indicate a classpath change? - * @param flags the flags to inspect - * @return true if the flag flags a classpath change - */ - private boolean isClasspathChangeFlag(int flags) { - if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) - return true; - - if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) - return true; - - if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) - return true; - - if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) - return true; - - return false; - } - } - - - /** - * Engine used to compute the proposals for this computer - */ - private final TemplateEngine fE4TemplateEngine; - private final TemplateEngine fE4MembersTemplateEngine; - private final TemplateEngine fE4StatementsTemplateEngine; - - /** - * The Java project of the compilation unit for which a template - * engine has been computed last time if any - */ - private IJavaProject fCachedJavaProject; - /** - * Is org.eclipse.e4.core.services.IDisposable on class path of <code>fJavaProject</code>. Invalid - * if <code>fJavaProject</code> is <code>false</code>. - */ - private boolean fIsE4OnClasspath; - - public E4TemplateCompletionProposalComputer() { - ContextTypeRegistry templateContextRegistry= JavaPlugin.getDefault().getTemplateContextRegistry(); - fE4TemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_ALL); - fE4MembersTemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_MEMBERS); - fE4StatementsTemplateEngine= createTemplateEngine(templateContextRegistry, E4ContextType.ID_STATEMENTS); - - JavaCore.addElementChangedListener(new BuildPathChangeListener()); - } - - private static TemplateEngine createTemplateEngine(ContextTypeRegistry templateContextRegistry, String contextTypeId) { - TemplateContextType contextType= templateContextRegistry.getContextType(contextTypeId); - Assert.isNotNull(contextType); - return new TemplateEngine(contextType); - } - - protected TemplateEngine computeCompletionEngine(JavaContentAssistInvocationContext context) { - ICompilationUnit unit= context.getCompilationUnit(); - if (unit == null) - return null; - - IJavaProject javaProject= unit.getJavaProject(); - if (javaProject == null) - return null; - - if (isE4OnClasspath(javaProject)) { - CompletionContext coreContext= context.getCoreContext(); - if (coreContext != null) { - int tokenLocation= coreContext.getTokenLocation(); - if ((tokenLocation & CompletionContext.TL_MEMBER_START) != 0) { - return fE4MembersTemplateEngine; - } - if ((tokenLocation & CompletionContext.TL_STATEMENT_START) != 0) { - return fE4StatementsTemplateEngine; - } - } - return fE4TemplateEngine; - } - - return null; - } - - /** - * Tells whether E4 is on the given project's class path. - * - * @param javaProject the Java project - * @return <code>true</code> if the given project's class path - */ - private synchronized boolean isE4OnClasspath(IJavaProject javaProject) { - if (!javaProject.equals(fCachedJavaProject)) { - fCachedJavaProject= javaProject; - try { - IType type= javaProject.findType(E4_TYPE_NAME); - fIsE4OnClasspath= type != null; - } catch (JavaModelException e) { - fIsE4OnClasspath= false; - } - } - return fIsE4OnClasspath; - } - - /** - * Returns the cached Java project. - * - * @return the cached Java project or <code>null</code> if none - */ - private synchronized IJavaProject getCachedJavaProject() { - return fCachedJavaProject; - } - - /** - * Set the cached Java project. - * - * @param project or <code>null</code> to reset the cache - */ - private synchronized void setCachedJavaProject(IJavaProject project) { - fCachedJavaProject= project; - } - -} diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties deleted file mode 100644 index e69de29b..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.properties +++ /dev/null diff --git a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml b/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml deleted file mode 100644 index 33dd0808..00000000 --- a/bundles/org.eclipse.e4.tools.jdt.templates/templates/default-e4templates.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- -/******************************************************************************* - * Copyright (c) 2010 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Boris Bokowski, IBM Corporation - initial API and implementation - *******************************************************************************/ ---> - -<templates> - -<template name="e4-parent" description="Injected Parent Composite" id="org.eclipse.e4.tools.jdt.templates.parent" context="e4-members" enabled="true" autoinsert="false">@Inject -Composite parent;</template> - -<template name="e4-preference" description="Injected Preference Value" id="org.eclipse.e4.tools.jdt.templates.preference" context="e4-members" enabled="true" autoinsert="false">@Inject -void setPreferenceValue(@Named("preference-PREFERENCE_KEY") String preferenceValue) { - ${cursor} -}</template> - -<template name="e4-adapter" description="Injected Adapter Service" id="org.eclipse.e4.tools.jdt.templates.adapter" context="e4-members" enabled="true" autoinsert="false">@Inject -Adapter adapter;</template> - -<template name="e4-preferences" description="Injected Preferences Service" id="org.eclipse.e4.tools.jdt.templates.preferences" context="e4-members" enabled="true" autoinsert="false">@Inject -IEclipsePreferences preferences;</template> - -<template name="e4-statushandler" description="Injected Status Handler" id="org.eclipse.e4.tools.jdt.templates.statushandler" context="e4-members" enabled="true" autoinsert="false">@Inject -IStatusHandler statusHandler;</template> - -<template name="e4-logger" description="Injected Logger" id="org.eclipse.e4.tools.jdt.templates.logger" context="e4-members" enabled="true" autoinsert="false">@Inject -Logger logger;</template> - -<template name="e4-eventbroker" description="Injected Event Broker" id="org.eclipse.e4.tools.jdt.templates.eventbroker" context="e4-members" enabled="true" autoinsert="false">@Inject -IEventBroker eventBroker;</template> - -<template name="e4-stylingengine" description="Injected Styling Engine" id="org.eclipse.e4.tools.jdt.templates.stylingengine" context="e4-members" enabled="true" autoinsert="false">@Inject -IStylingEngine stylingEngine;</template> - -<template name="e4-event" description="Event Handler Method" id="org.eclipse.e4.tools.jdt.templates.eventhandler" context="e4-members" enabled="true" autoinsert="false">@EventHandler("some/event/topic") -void handleSomeEvent(Payload payloadObject) { - ${cursor} -}</template> - -<template name="e4-init" description="Initialization Method" id="org.eclipse.e4.tools.jdt.templates.init" context="e4-members" enabled="true" autoinsert="false">@PostConstruct -void init() { - ${cursor} -}</template> - -<template name="e4-dispose" description="Dispose Method" id="org.eclipse.e4.tools.jdt.templates.dispose" context="e4-members" enabled="true" autoinsert="false">@PreDestroy -void dispose() { - ${cursor} -}</template> - -</templates> diff --git a/features/org.eclipse.e4.core.tools.feature/.project b/features/org.eclipse.e4.core.tools.feature/.project deleted file mode 100644 index d0fa7e44..00000000 --- a/features/org.eclipse.e4.core.tools.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.e4.core.tools.feature</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.pde.FeatureBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.FeatureNature</nature> - </natures> -</projectDescription> diff --git a/features/org.eclipse.e4.core.tools.feature/build.properties b/features/org.eclipse.e4.core.tools.feature/build.properties deleted file mode 100644 index b3a611b5..00000000 --- a/features/org.eclipse.e4.core.tools.feature/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -bin.includes = feature.xml,\ - feature.properties diff --git a/features/org.eclipse.e4.core.tools.feature/feature.properties b/features/org.eclipse.e4.core.tools.feature/feature.properties deleted file mode 100755 index b4f9dc81..00000000 --- a/features/org.eclipse.e4.core.tools.feature/feature.properties +++ /dev/null @@ -1,148 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2009 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Eclipse e4 Tools (Incubation) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Project Updates - -# "secondarySiteName" property - label for the update site -secondaryUpdateSiteName=Ganymede Discovery Site - - -# "description" property - description of the feature -description=Eclipse e4 Multiple Programming Language - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2000, 2009 IBM Corporation and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - IBM Corporation - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/feature.xml b/features/org.eclipse.e4.core.tools.feature/feature.xml deleted file mode 100644 index 0106e2cb..00000000 --- a/features/org.eclipse.e4.core.tools.feature/feature.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.e4.core.tools.feature" - label="%featureName" - version="0.9.0.qualifier" - provider-name="%providerName"> - - <description> - %description - </description> - - <copyright> - %copyright - </copyright> - - <license url="%licenseURL"> - %license - </license> - - <plugin - id="org.eclipse.e4.tools.emf.editor3x" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.emf.ui" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.compat" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.services" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - - <plugin - id="org.eclipse.e4.tools.emf.liveeditor" - download-size="0" - install-size="0" - version="0.0.0" - unpack="false"/> - -</feature> diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg Binary files differdeleted file mode 100755 index bfdf708a..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/eclipse_update_120.jpg +++ /dev/null diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100755 index ed4b1966..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ -<html xmlns:o="urn:schemas-microsoft-com:office:office" -xmlns:w="urn:schemas-microsoft-com:office:word" -xmlns="http://www.w3.org/TR/REC-html40"> - -<head> -<meta http-equiv=Content-Type content="text/html; charset=windows-1252"> -<meta name=ProgId content=Word.Document> -<meta name=Generator content="Microsoft Word 9"> -<meta name=Originator content="Microsoft Word 9"> -<link rel=File-List -href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"> -<title>Eclipse Public License - Version 1.0</title> -<!--[if gte mso 9]><xml> - <o:DocumentProperties> - <o:Revision>2</o:Revision> - <o:TotalTime>3</o:TotalTime> - <o:Created>2004-03-05T23:03:00Z</o:Created> - <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> - <o:Pages>4</o:Pages> - <o:Words>1626</o:Words> - <o:Characters>9270</o:Characters> - <o:Lines>77</o:Lines> - <o:Paragraphs>18</o:Paragraphs> - <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> - <o:Version>9.4402</o:Version> - </o:DocumentProperties> -</xml><![endif]--><!--[if gte mso 9]><xml> - <w:WordDocument> - <w:TrackRevisions/> - </w:WordDocument> -</xml><![endif]--> -<style> -<!-- - /* Font Definitions */ -@font-face - {font-family:Tahoma; - panose-1:2 11 6 4 3 5 4 4 2 4; - mso-font-charset:0; - mso-generic-font-family:swiss; - mso-font-pitch:variable; - mso-font-signature:553679495 -2147483648 8 0 66047 0;} - /* Style Definitions */ -p.MsoNormal, li.MsoNormal, div.MsoNormal - {mso-style-parent:""; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p - {margin-right:0in; - mso-margin-top-alt:auto; - mso-margin-bottom-alt:auto; - margin-left:0in; - mso-pagination:widow-orphan; - font-size:12.0pt; - font-family:"Times New Roman"; - mso-fareast-font-family:"Times New Roman";} -p.BalloonText, li.BalloonText, div.BalloonText - {mso-style-name:"Balloon Text"; - margin:0in; - margin-bottom:.0001pt; - mso-pagination:widow-orphan; - font-size:8.0pt; - font-family:Tahoma; - mso-fareast-font-family:"Times New Roman";} -@page Section1 - {size:8.5in 11.0in; - margin:1.0in 1.25in 1.0in 1.25in; - mso-header-margin:.5in; - mso-footer-margin:.5in; - mso-paper-source:0;} -div.Section1 - {page:Section1;} ---> -</style> -</head> - -<body lang=EN-US style='tab-interval:.5in'> - -<div class=Section1> - -<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b> -</p> - -<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.</span> </p> - -<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p> - -<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and<br clear=left> -b) in the case of each subsequent Contributor:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -changes to the Program, and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -additions to the Program;</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Contributor" means any person or -entity that distributes the Program.</span> </p> - -<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program. </span></p> - -<p><span style='font-size:10.0pt'>"Program" means the Contributions -distributed in accordance with this Agreement.</span> </p> - -<p><span style='font-size:10.0pt'>"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.</span> </p> - -<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to<span -style='color:red'> </span>reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder. </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement. </span></p> - -<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p> - -<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that:</span> -</p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it complies with the terms and conditions of this Agreement; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) -its license agreement:</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits; </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and</span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.<span style='color:blue'> </span></span></p> - -<p><span style='font-size:10.0pt'>When the Program is made available in source -code form:</span> </p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a) -it must be made available under this Agreement; and </span></p> - -<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a -copy of this Agreement must be included with each copy of the Program. </span></p> - -<p><span style='font-size:10.0pt'>Contributors may not remove or alter any -copyright notices contained within the Program. </span></p> - -<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution. </span></p> - -<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p> - -<p><span style='font-size:10.0pt'>Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.</span> </p> - -<p><span style='font-size:10.0pt'>For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.</span> </p> - -<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations. </span></p> - -<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p> - -<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.</span> </p> - -<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p> - -<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.</span> </p> - -<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed. </span></p> - -<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive. </span></p> - -<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.</span> </p> - -<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.</span> </p> - -<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p> - -</div> - -</body> - -</html>
\ No newline at end of file diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties deleted file mode 100755 index 7b266ca8..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2007 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Eclipse e4 Tools Source (Incubation) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Project Updates - -# "description" property - description of the feature -description=Source code zips for Eclipse E4 initiative. - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2000, 2007 IBM Corporation and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - IBM Corporation - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html b/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html deleted file mode 100755 index c6af966b..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,79 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> -<html> -<head> -<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"> -<title>Eclipse.org Software User Agreement</title> -</head> - -<body lang="EN-US" link=blue vlink=purple> -<h2>Eclipse Foundation Software User Agreement</h2> -<p>March 17, 2005</p> - -<h3>Usage Of Content</h3> - -<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p> - -<h3>Applicable Licenses</h3> - -<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. - For purposes of the EPL, "Program" will mean the Content.</p> - -<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").</p> - -<ul> - <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li> - <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li> - <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.</li> - <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li> -</ul> - -<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:</p> - -<ul> - <li>The top-level (root) directory</li> - <li>Plug-in and Fragment directories</li> - <li>Inside Plug-ins and Fragments packaged as JARs</li> - <li>Sub-directories of the directory named "src" of certain Plug-ins</li> - <li>Feature directories</li> -</ul> - -<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.</p> - -<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p> - -<ul> - <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li> - <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li> - <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li> - <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li> - <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li> - <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li> -</ul> - -<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p> - -<h3>Cryptography</h3> - -<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.</p> - -<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small> -</body> -</html> diff --git a/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties b/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties deleted file mode 100755 index cdb3ab38..00000000 --- a/features/org.eclipse.e4.core.tools.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2006 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### -bin.includes = plugin.xml, src/**, META-INF/ -sourcePlugin = true |