From dd62e991f7e2304896231850c218e7bcb917bca7 Mon Sep 17 00:00:00 2001 From: basp91 Date: Sat, 19 Jan 2019 23:20:52 +0000 Subject: [PATCH] advanced tab when creating plugins + initial checked state of plugins + removal of updater/query language plugins in preferences --- ...ancePluginConfigurationPreferencePage.java | 285 ++++-------------- .../preferences/HawkPluginSelectionBlock.java | 208 +++++++++++++ .../src/org/hawk/ui2/wizard/HWizardPage.java | 80 +++-- 3 files changed, 316 insertions(+), 257 deletions(-) create mode 100644 plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkPluginSelectionBlock.java diff --git a/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkInstancePluginConfigurationPreferencePage.java b/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkInstancePluginConfigurationPreferencePage.java index f97cb0c57..59d5db6d6 100644 --- a/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkInstancePluginConfigurationPreferencePage.java +++ b/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkInstancePluginConfigurationPreferencePage.java @@ -18,37 +18,23 @@ package org.hawk.ui2.preferences; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.ICheckStateProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IToolTipProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; import org.hawk.core.IMetaModelResourceFactory; import org.hawk.core.IModelResourceFactory; -import org.hawk.core.IModelUpdater; import org.hawk.core.graph.IGraphChangeListener; -import org.hawk.core.query.IQueryEngine; -import org.hawk.osgiserver.HManager; import org.hawk.osgiserver.HModel; import org.hawk.ui2.util.HUIManager; @@ -56,21 +42,15 @@ public class HawkInstancePluginConfigurationPreferencePage extends PreferencePag private Combo combo; - private Composite control; - - private CheckboxTableViewer metamodelTableViewer; - private CheckboxTableViewer modelTableViewer; - private CheckboxTableViewer modelUpdaterTableViewer; - private CheckboxTableViewer graphChangeListenerTableViewer; - private CheckboxTableViewer queryEnginesTableViewer; + private HawkPluginSelectionBlock pluginBlock; public HawkInstancePluginConfigurationPreferencePage() { super("Instance Configuration"); } - + @Override - public void init(IWorkbench workbench) {} - + public void init(IWorkbench workbench) { + } @Override protected Control createContents(Composite parent) { @@ -88,257 +68,98 @@ protected Control createContents(Composite parent) { } combo.select(0); - Font font = parent.getFont(); - - control = new Composite(parent, SWT.NONE); - control.setFont(font); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 9; - layout.horizontalSpacing = 1; - control.setLayout(layout); - - // METAMODEL PARSER - - Label label = new Label(control, SWT.NULL); - label.setText("&Metamodel plugins:"); - - metamodelTableViewer = newTableViewer(); - metamodelTableViewer.setLabelProvider(new TypedLabelProvider(IMetaModelResourceFactory.class)); - metamodelTableViewer.setContentProvider(new TypedContentProvider("getMetamodelParserInstances")); - metamodelTableViewer.setInput(HManager.getInstance().getMetamodelParserInstances().values().toArray()); - metamodelTableViewer.setCheckStateProvider(new TypedCheckStateProvider(IMetaModelResourceFactory.class)); - - // MODEL PARSER - - label = new Label(control, SWT.NULL); - label.setText("&Model plugins:"); - - modelTableViewer = newTableViewer(); - modelTableViewer.setLabelProvider(new TypedLabelProvider(IModelResourceFactory.class)); - modelTableViewer.setContentProvider(new TypedContentProvider("getModelParserInstances")); - modelTableViewer.setInput(HManager.getInstance().getModelParserInstances().values().toArray()); - modelTableViewer.setCheckStateProvider(new TypedCheckStateProvider(IModelResourceFactory.class)); - - // MODEL UPDATER - - label = new Label(control, SWT.NULL); - label.setText("&Model updater plugins:"); - - modelUpdaterTableViewer = newTableViewer(); - modelUpdaterTableViewer.setLabelProvider(new TypedLabelProvider(IModelUpdater.class)); - modelUpdaterTableViewer.setContentProvider(new TypedContentProvider("getModelUpdaterInstances")); - modelUpdaterTableViewer.setInput(HManager.getInstance().getMetamodelParserInstances().values().toArray()); - modelUpdaterTableViewer.setCheckStateProvider(new TypedCheckStateProvider(IModelUpdater.class)); - - // QUERY LANGUAGES - - label = new Label(control, SWT.NULL); - label.setText("&Query language plugins:"); + pluginBlock = new HawkPluginSelectionBlock(); + pluginBlock.createControl(parent); + pluginBlock.getMetamodelTableViewer().setCheckStateProvider(new TypedCheckStateProvider(IMetaModelResourceFactory.class)); + pluginBlock.getGraphChangeListenerTableViewer().setCheckStateProvider(new TypedCheckStateProvider(IGraphChangeListener.class)); + pluginBlock.getModelTableViewer().setCheckStateProvider(new TypedCheckStateProvider(IModelResourceFactory.class)); - queryEnginesTableViewer = newTableViewer(); - queryEnginesTableViewer.setLabelProvider(new TypedLabelProvider(IQueryEngine.class)); - queryEnginesTableViewer.setContentProvider(new TypedContentProvider("getQueryLanguageInstances")); - queryEnginesTableViewer.setInput(HManager.getInstance().getModelParserInstances().values().toArray()); - queryEnginesTableViewer.setCheckStateProvider(new TypedCheckStateProvider(IQueryEngine.class)); - // GRAPH CHANGE LISTENERS - - label = new Label(control, SWT.NULL); - label.setText("&Graph change listeners plugins:"); - - graphChangeListenerTableViewer = newTableViewer(); - graphChangeListenerTableViewer.setLabelProvider(new TypedLabelProvider(IGraphChangeListener.class)); - graphChangeListenerTableViewer.setContentProvider(new TypedContentProvider("getGraphChangeListenerInstances")); - graphChangeListenerTableViewer.setInput(HManager.getInstance().getModelParserInstances().values().toArray()); - graphChangeListenerTableViewer.setCheckStateProvider(new TypedCheckStateProvider(IGraphChangeListener.class)); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - update(); + pluginBlock.update(); } }); - - update(); + + pluginBlock.update(); getSelectedHawkInstance(); - - GridData data = new GridData(GridData.FILL_BOTH); - data.horizontalSpan = 1; - control.setLayoutData(data); - return parent; } - public HModel getSelectedHawkInstance() { - return HUIManager.getInstance().getHawkByName(combo.getItem(combo.getSelectionIndex())); - } - - class TypedCheckStateProvider implements ICheckStateProvider { - - private Class clazz; - - public TypedCheckStateProvider(Class clazz) { - this.clazz = clazz; - } - - @Override - public boolean isGrayed(Object element) { - return false; - } - - @Override - public boolean isChecked(Object element) { - try{ - String plugin = (String) clazz.getMethod("getType").invoke(clazz.cast(element)); - return getSelectedHawkInstance().getEnabledPlugins().contains(plugin); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - } - - - class TypedContentProvider implements IStructuredContentProvider { - - private String method; - - public TypedContentProvider(String method) { - this.method = method; - } - - @SuppressWarnings("rawtypes") - @Override - public Object[] getElements(Object input) { - try{ - Map invoke = (Map) HManager.class.getMethod(method).invoke(HManager.getInstance()); - return invoke.values().toArray(); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - - @Override - public void dispose() {} - - } - - - class TypedLabelProvider extends LabelProvider implements IToolTipProvider { - - private Class clazz; - - public TypedLabelProvider(Class clazz) { - this.clazz = clazz; - } - - @Override - public String getText(Object element) { - try{ - return (String) clazz.getMethod("getHumanReadableName").invoke(clazz.cast(element)); - } catch (Exception e) { - e.printStackTrace(); - return ""; - } - } - - @Override - public String getToolTipText(Object element) { - try{ - return (String) clazz.getMethod("getType").invoke(clazz.cast(element)); - } catch (Exception e) { - e.printStackTrace(); - return ""; - } - } - - } - - public void update() { - this.metamodelTableViewer.refresh(); - this.modelTableViewer.refresh(); - this.graphChangeListenerTableViewer.refresh(); - this.modelUpdaterTableViewer.refresh(); - this.queryEnginesTableViewer.refresh(); - } - - private CheckboxTableViewer newTableViewer(){ - CheckboxTableViewer modelTableViewer = CheckboxTableViewer.newCheckList(control, SWT.BORDER | SWT.V_SCROLL | SWT.FILL); - modelTableViewer.setUseHashlookup(true); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - modelTableViewer.getTable().setLayoutData(gd); - modelTableViewer.getTable().setHeaderVisible(false); - return modelTableViewer; - } - @Override protected void performDefaults() { - update(); + pluginBlock.update(); } - + @Override public boolean performOk() { performApply(); return super.performOk(); } - @Override protected void performApply() { try { HModel hawk = getSelectedHawkInstance(); hawk.addPlugins(getAdditionalPluginsFromChecked()); - hawk.removePlugins(getPluginsToRemoveFromUnchecked()); + // hawk.removePlugins(getPluginsToRemoveFromUnchecked()); HUIManager.getInstance().saveHawkToMetadata(hawk, true); } catch (Exception e) { e.printStackTrace(); } - update(); + pluginBlock.update(); } + + public HModel getSelectedHawkInstance() { + return HUIManager.getInstance().getHawkByName(combo.getItem(combo.getSelectionIndex())); + } + - private List getAdditionalPluginsFromChecked(){ + private List getAdditionalPluginsFromChecked() { List result = new ArrayList<>(); List enabledPlugins = getSelectedHawkInstance().getEnabledPlugins(); - getAllChecked().stream().forEach(type -> { + pluginBlock.getAllChecked().stream().forEach(type -> { if (!enabledPlugins.contains(type)) { result.add(type); } }); return result; } - - private List getPluginsToRemoveFromUnchecked(){ + + // FIXME + private List getPluginsToRemoveFromUnchecked() { List enabled = new ArrayList<>(getSelectedHawkInstance().getEnabledPlugins()); - enabled.removeAll(getAllChecked()); - return enabled; - } - - private List getAllChecked(){ - List checked = new ArrayList<>(); - checked.addAll(getCheckedList(metamodelTableViewer, IMetaModelResourceFactory.class)); - checked.addAll(getCheckedList(modelTableViewer, IModelResourceFactory.class)); - checked.addAll(getCheckedList(modelUpdaterTableViewer, IModelUpdater.class)); - checked.addAll(getCheckedList(queryEnginesTableViewer, IQueryEngine.class)); - checked.addAll(getCheckedList(graphChangeListenerTableViewer, IGraphChangeListener.class)); - return checked; + enabled.removeAll(pluginBlock.getAllChecked()); + return enabled; } - - private List getCheckedList(CheckboxTableViewer viewer, Class clazz){ - return Arrays.asList( - viewer.getCheckedElements()).stream() - .map(e -> { - try{ - return (String) clazz.getMethod("getType").invoke(clazz.cast(e)); - } catch (Exception ex) { - return ""; - } - }).collect(Collectors.toList()); + + + class TypedCheckStateProvider implements ICheckStateProvider { + + private Class clazz; + + public TypedCheckStateProvider(Class clazz) { + this.clazz = clazz; + } + + @Override + public boolean isGrayed(Object element) { + return false; + } + + @Override + public boolean isChecked(Object element) { + try { + String plugin = (String) clazz.getMethod("getType").invoke(clazz.cast(element)); + return getSelectedHawkInstance().getEnabledPlugins().contains(plugin); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } } } \ No newline at end of file diff --git a/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkPluginSelectionBlock.java b/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkPluginSelectionBlock.java new file mode 100644 index 000000000..b15e9e0ad --- /dev/null +++ b/plugins/org.hawk.ui2/src/org/hawk/ui2/preferences/HawkPluginSelectionBlock.java @@ -0,0 +1,208 @@ +/******************************************************************************* + * Copyright (c) 2011-2015 The University of York. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License, v. 2.0 are satisfied: GNU General Public License, version 3. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-3.0 + * + * Contributors: + * Antonio Garcia-Dominguez - initial API and implementation + * Beatriz Sanchez - some UI updates + ******************************************************************************/ +package org.hawk.ui2.preferences; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IToolTipProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.hawk.core.IMetaModelResourceFactory; +import org.hawk.core.IModelResourceFactory; +import org.hawk.core.graph.IGraphChangeListener; +import org.hawk.osgiserver.HManager; + +public class HawkPluginSelectionBlock { + + private Composite control; + + private CheckboxTableViewer metamodelTableViewer; + private CheckboxTableViewer modelTableViewer; + private CheckboxTableViewer graphChangeListenerTableViewer; + + public void createControl(Composite parent) { + control = new Composite(parent, SWT.NONE); + Font font = parent.getFont(); + control.setFont(font); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 9; + layout.horizontalSpacing = 1; + control.setLayout(layout); + + // METAMODEL PARSER + + Label label = new Label(control, SWT.NULL); + label.setText("&Metamodel plugins:"); + + metamodelTableViewer = newTableViewer(); + metamodelTableViewer.setLabelProvider(new TypedLabelProvider(IMetaModelResourceFactory.class)); + metamodelTableViewer.setContentProvider(new TypedContentProvider("getMetamodelParserInstances")); + metamodelTableViewer.setInput(HManager.getInstance().getMetamodelParserInstances().values().toArray()); + metamodelTableViewer.setAllChecked(true); + + // MODEL PARSER + + label = new Label(control, SWT.NULL); + label.setText("&Model plugins:"); + + modelTableViewer = newTableViewer(); + modelTableViewer.setLabelProvider(new TypedLabelProvider(IModelResourceFactory.class)); + modelTableViewer.setContentProvider(new TypedContentProvider("getModelParserInstances")); + modelTableViewer.setInput(HManager.getInstance().getModelParserInstances().values().toArray()); + modelTableViewer.setAllChecked(true); + + // GRAPH CHANGE LISTENERS + + label = new Label(control, SWT.NULL); + label.setText("&Graph change listeners plugins:"); + + graphChangeListenerTableViewer = newTableViewer(); + graphChangeListenerTableViewer.setLabelProvider(new TypedLabelProvider(IGraphChangeListener.class)); + graphChangeListenerTableViewer.setContentProvider(new TypedContentProvider("getGraphChangeListenerInstances")); + graphChangeListenerTableViewer.setInput(HManager.getInstance().getModelParserInstances().values().toArray()); + graphChangeListenerTableViewer.setAllChecked(false); + + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 1; + control.setLayoutData(data); + } + + public CheckboxTableViewer getMetamodelTableViewer() { + return metamodelTableViewer; + } + + public CheckboxTableViewer getModelTableViewer() { + return modelTableViewer; + } + + public CheckboxTableViewer getGraphChangeListenerTableViewer() { + return graphChangeListenerTableViewer; + } + + public Composite getControl() { + return control; + } + + public void update() { + this.metamodelTableViewer.refresh(); + this.modelTableViewer.refresh(); + this.graphChangeListenerTableViewer.refresh(); + } + + public List getAllChecked() { + List checked = new ArrayList<>(); + checked.addAll(getCheckedList(metamodelTableViewer, IMetaModelResourceFactory.class)); + checked.addAll(getCheckedList(modelTableViewer, IModelResourceFactory.class)); + checked.addAll(getCheckedList(graphChangeListenerTableViewer, IGraphChangeListener.class)); + return checked; + } + + class TypedContentProvider implements IStructuredContentProvider { + + private String method; + + public TypedContentProvider(String method) { + this.method = method; + } + + @SuppressWarnings("rawtypes") + @Override + public Object[] getElements(Object input) { + try { + Map invoke = (Map) HManager.class.getMethod(method).invoke(HManager.getInstance()); + return invoke.values().toArray(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + @Override + public void dispose() { + } + + } + + class TypedLabelProvider extends LabelProvider implements IToolTipProvider { + + private Class clazz; + + public TypedLabelProvider(Class clazz) { + this.clazz = clazz; + } + + @Override + public String getText(Object element) { + try { + return (String) clazz.getMethod("getHumanReadableName").invoke(clazz.cast(element)); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + @Override + public String getToolTipText(Object element) { + try { + return (String) clazz.getMethod("getType").invoke(clazz.cast(element)); + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + } + + private CheckboxTableViewer newTableViewer() { + CheckboxTableViewer modelTableViewer = CheckboxTableViewer.newCheckList(control, + SWT.BORDER | SWT.V_SCROLL | SWT.FILL); + modelTableViewer.setUseHashlookup(true); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + modelTableViewer.getTable().setLayoutData(gd); + modelTableViewer.getTable().setHeaderVisible(false); + return modelTableViewer; + } + + private List getCheckedList(CheckboxTableViewer viewer, Class clazz) { + return Arrays.asList(viewer.getCheckedElements()).stream().map(e -> { + try { + return (String) clazz.getMethod("getType").invoke(clazz.cast(e)); + } catch (Exception ex) { + return ""; + } + }).collect(Collectors.toList()); + } + +} \ No newline at end of file diff --git a/plugins/org.hawk.ui2/src/org/hawk/ui2/wizard/HWizardPage.java b/plugins/org.hawk.ui2/src/org/hawk/ui2/wizard/HWizardPage.java index 10f995b83..f9f789d76 100644 --- a/plugins/org.hawk.ui2/src/org/hawk/ui2/wizard/HWizardPage.java +++ b/plugins/org.hawk.ui2/src/org/hawk/ui2/wizard/HWizardPage.java @@ -56,6 +56,8 @@ import org.eclipse.swt.widgets.DirectoryDialog; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Layout; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Text; import org.hawk.core.IHawkFactory; import org.hawk.core.IMetaModelResourceFactory; @@ -65,6 +67,7 @@ import org.hawk.core.runtime.ModelIndexerImpl; import org.hawk.osgiserver.HManager; import org.hawk.ui2.Activator; +import org.hawk.ui2.preferences.HawkPluginSelectionBlock; import org.hawk.ui2.util.HUIManager; public class HWizardPage extends WizardPage { @@ -130,6 +133,8 @@ public void modifyText(ModifyEvent e) { private Map updaters; private Map models; private Map metamodels; + + private HawkPluginSelectionBlock pluginSelectionBlock; public HWizardPage(ISelection selection) { super("wizardPage"); @@ -144,6 +149,38 @@ public void createControl(Composite parent) { hminstance = HUIManager.getInstance(); + TabFolder tabFolder = new TabFolder(parent, SWT.BORDER); + tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + TabItem mainConfigTab = new TabItem(tabFolder, SWT.NULL); + mainConfigTab.setText("Base Configuration"); + mainConfigTab.setControl(createBaseConfig(tabFolder)); + + TabItem advancedTab = new TabItem(tabFolder, SWT.NULL); + advancedTab.setText("Advanced"); + advancedTab.setControl(createAdvancedConfig(tabFolder)); + + } + + private Composite createAdvancedConfig(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + layout.verticalSpacing = 9; + container.setLayout(layout); + + GridData gd; + + pluginSelectionBlock = new HawkPluginSelectionBlock(); + pluginSelectionBlock.createControl(container); + + //enableOrDisable(container, pluginSelectionBlock.getMetamodelTableViewer(), pluginSelectionBlock.getModelTableViewer(), pluginSelectionBlock.getGraphChangeListenerTableViewer()); + + return container; + } + + + private Composite createBaseConfig(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 3; @@ -278,6 +315,8 @@ public String getText(Object element) { initialize(); dialogChanged(); setControl(container); + + return container; } private List getBackendNames() { @@ -326,16 +365,25 @@ public void checkStateChanged(CheckStateChangedEvent event) { } }); - Composite cTableButtons = new Composite(container, SWT.NULL); - gd = new GridData(SWT.FILL, SWT.TOP, true, true); + enableOrDisable(container, tableviewer); + + return tableviewer; + } + + private void enableOrDisable(Composite parent, final CheckboxTableViewer... tableviewers) { + Composite cTableButtons = new Composite(parent, SWT.NULL); + GridData gd = new GridData(SWT.FILL, SWT.TOP, true, true); cTableButtons.setLayoutData(gd); cTableButtons.setLayout(new FillLayout(SWT.VERTICAL)); + Button btnEnableAll = new Button(cTableButtons, SWT.NULL); btnEnableAll.setText("Enable all"); btnEnableAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - tableviewer.setAllChecked(true); + for (CheckboxTableViewer tableviewer : tableviewers) { + tableviewer.setAllChecked(true); + } dialogChanged(); } }); @@ -344,11 +392,12 @@ public void widgetSelected(SelectionEvent e) { btnDisableAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - tableviewer.setAllChecked(false); + for (CheckboxTableViewer tableviewer : tableviewers) { + tableviewer.setAllChecked(false); + } dialogChanged(); } }); - return tableviewer; } private void initialize() { @@ -566,32 +615,13 @@ public String getContainerName() { return folderText.getText(); } - protected List getSelectedModelPlugins() { - Map modelFactories = hminstance.getModelParserInstances(); - List checked = Arrays.asList((String[]) modelPluginTable.getCheckedElements()); - List plugins = modelFactories.entrySet().stream() - .filter(e -> checked.contains(e.getValue().getHumanReadableName())).map(m -> m.getKey()) - .collect(Collectors.toList()); - return plugins; - } - - protected List getSelectedMetaModelPlugins() { - Map modelFactories = hminstance.getMetamodelParserInstances(); - List checked = Arrays.asList((String[]) metamodelPluginTable.getCheckedElements()); - List plugins = modelFactories.entrySet().stream() - .filter(e -> checked.contains(e.getValue().getHumanReadableName())).map(m -> m.getKey()) - .collect(Collectors.toList()); - return plugins; - } - protected List getSelectedModelUpdaterPlugins() { return Arrays.asList(updaterPluginTable.getCheckedElements()).stream().map(e -> (String) e).collect(Collectors.toList()); } protected List getSelectedAdvancedPlugins() { List selected = new ArrayList(); - //selected.addAll(getSelectedModelPlugins()); - //selected.addAll(getSelectedMetaModelPlugins()); + selected.addAll(pluginSelectionBlock.getAllChecked()); selected.addAll(getSelectedModelUpdaterPlugins()); return selected; }