Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 395283 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.e4.tools.emf.ui/META-INF/MANIFEST.MF (-1 / +2 lines)
Lines 2-8 Manifest-Version: 1.0 Link Here
2
Bundle-ManifestVersion: 2
2
Bundle-ManifestVersion: 2
3
Bundle-Name: %pluginName
3
Bundle-Name: %pluginName
4
Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true
4
Bundle-SymbolicName: org.eclipse.e4.tools.emf.ui;singleton:=true
5
Bundle-Version: 0.12.0.qualifier
5
Bundle-Version: 0.12.1.qualifier
6
Bundle-ClassPath: .
6
Bundle-ClassPath: .
7
Bundle-Vendor: %providerName
7
Bundle-Vendor: %providerName
8
Bundle-Localization: plugin
8
Bundle-Localization: plugin
Lines 45-47 Export-Package: org.eclipse.e4.tools.emf.ui.common, Link Here
45
 org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;x-internal:=true,
45
 org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;x-internal:=true,
46
 org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor"
46
 org.eclipse.e4.tools.emf.ui.internal.wbm;x-friends:="org.eclipse.e4.tools.emf.editor"
47
Service-Component: OSGI-INF/contributioncollector.xml, OSGI-INF/resourceprovider.xml
47
Service-Component: OSGI-INF/contributioncollector.xml, OSGI-INF/resourceprovider.xml
48
Bundle-Activator: org.eclipse.e4.tools.emf.ui.internal.ToolsEmfUiPlugin
(-)a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/ToolsEmfUiPlugin.java (+144 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2012 MEDEVIT and FHV and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Marco Descher <marco@descher.at> - initial API and implementation
10
 ******************************************************************************/
11
package org.eclipse.e4.tools.emf.ui.internal;
12
13
import java.io.File;
14
import java.io.IOException;
15
import java.net.URISyntaxException;
16
import org.eclipse.core.runtime.URIUtil;
17
import org.eclipse.jface.dialogs.DialogSettings;
18
import org.eclipse.jface.dialogs.IDialogSettings;
19
import org.eclipse.osgi.service.datalocation.Location;
20
import org.osgi.framework.BundleActivator;
21
import org.osgi.framework.BundleContext;
22
import org.osgi.framework.Filter;
23
import org.osgi.framework.InvalidSyntaxException;
24
import org.osgi.util.tracker.ServiceTracker;
25
26
public class ToolsEmfUiPlugin implements BundleActivator {
27
	// The plug-in ID
28
	public static final String PLUGIN_ID = "org.eclipse.e4.tools.emf.ui"; //$NON-NLS-1$
29
30
	private static ToolsEmfUiPlugin plugin;
31
	private BundleContext context;
32
33
	private ServiceTracker locationTracker;
34
35
	public void start(BundleContext context) throws Exception {
36
		plugin = this;
37
		this.context = context;
38
	}
39
40
	public void stop(BundleContext context) throws Exception {
41
		saveDialogSettings();
42
		plugin = null;
43
	}
44
45
	/**
46
	 * Returns the shared instance
47
	 * 
48
	 * @return the shared instance
49
	 */
50
	public static ToolsEmfUiPlugin getDefault() {
51
		return plugin;
52
	}
53
54
	/**
55
	 * @return the instance Location service
56
	 */
57
	private Location getInstanceLocation() {
58
		if (locationTracker == null) {
59
			Filter filter = null;
60
			try {
61
				filter = context.createFilter(Location.INSTANCE_FILTER);
62
			} catch (InvalidSyntaxException e) {
63
				// ignore this. It should never happen as we have tested the
64
				// above format.
65
			}
66
			locationTracker = new ServiceTracker(context, filter, null);
67
			locationTracker.open();
68
		}
69
		return (Location) locationTracker.getService();
70
	}
71
72
	private void loadDialogSettings() {
73
		dialogSettings = new DialogSettings(PLUGIN_ID);
74
75
		File dialogSettingsFile = getDialogSettingsFile();
76
77
		if (dialogSettingsFile.exists()) {
78
			try {
79
				dialogSettings.load(dialogSettingsFile.getAbsolutePath());
80
			} catch (IOException e) {
81
				// load failed spec'ed to ignore problems
82
			}
83
			return;
84
		}
85
86
	}
87
88
	private void saveDialogSettings() {
89
		if (dialogSettings == null) {
90
			return;
91
		}
92
93
		File dialogSettingsFile = getDialogSettingsFile();
94
95
		try {
96
			dialogSettings.save(dialogSettingsFile.getAbsolutePath());
97
		} catch (IOException e) {
98
			e.printStackTrace();
99
			// spec'ed to ignore problems
100
		}
101
	}
102
103
	private File getDialogSettingsFile() {
104
		File baseLocation;
105
		try {
106
			baseLocation = new File(URIUtil.toURI(getInstanceLocation().getURL()));
107
		} catch (URISyntaxException e) {
108
			throw new RuntimeException(e);
109
		}
110
		baseLocation = new File(baseLocation, ".metadata"); //$NON-NLS-1$
111
		baseLocation = new File(baseLocation, ".plugins"); //$NON-NLS-1$
112
		baseLocation = new File(baseLocation, PLUGIN_ID);
113
		File dialogSettingsFile = new File(baseLocation, FN_DIALOG_SETTINGS);
114
		if (!dialogSettingsFile.exists())
115
			dialogSettingsFile.getParentFile().mkdirs();
116
		return dialogSettingsFile;
117
	}
118
119
	// //////////////////////////////////////////////////////////////////////
120
	// The following code was copied from AbstractUIPlugin class.
121
	/**
122
	 * The name of the dialog settings file (value
123
	 * <code>"dialog_settings.xml"</code>).
124
	 */
125
	private static final String FN_DIALOG_SETTINGS = "dialog_settings.xml"; //$NON-NLS-1$
126
	/**
127
	 * Storage for dialog and wizard data; <code>null</code> if not yet
128
	 * initialized.
129
	 */
130
	private IDialogSettings dialogSettings = null;
131
132
	/**
133
	 * @see AbstractUiPlugin#getDialogSettings()
134
	 * @return the dialog settings
135
	 */
136
	public IDialogSettings getDialogSettings() {
137
		if (dialogSettings == null) {
138
			loadDialogSettings();
139
		}
140
141
		return dialogSettings;
142
	}
143
144
}
(-)a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java (+8 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
10
 *     Marco Descher <marco@descher.at> - Bug395283
10
 ******************************************************************************/
11
 ******************************************************************************/
11
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
13
Lines 15-20 import java.util.List; Link Here
15
import org.eclipse.e4.tools.emf.ui.common.IModelResource;
16
import org.eclipse.e4.tools.emf.ui.common.IModelResource;
16
import org.eclipse.e4.tools.emf.ui.internal.Messages;
17
import org.eclipse.e4.tools.emf.ui.internal.Messages;
17
import org.eclipse.e4.tools.emf.ui.internal.PatternFilter;
18
import org.eclipse.e4.tools.emf.ui.internal.PatternFilter;
19
import org.eclipse.e4.tools.emf.ui.internal.ToolsEmfUiPlugin;
18
import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory;
20
import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory;
19
import org.eclipse.e4.ui.model.application.commands.MCommand;
21
import org.eclipse.e4.ui.model.application.commands.MCommand;
20
import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
22
import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
Lines 23-28 import org.eclipse.emf.common.util.TreeIterator; Link Here
23
import org.eclipse.emf.ecore.EObject;
25
import org.eclipse.emf.ecore.EObject;
24
import org.eclipse.emf.ecore.util.EcoreUtil;
26
import org.eclipse.emf.ecore.util.EcoreUtil;
25
import org.eclipse.emf.edit.domain.EditingDomain;
27
import org.eclipse.emf.edit.domain.EditingDomain;
28
import org.eclipse.jface.dialogs.IDialogSettings;
26
import org.eclipse.jface.dialogs.TitleAreaDialog;
29
import org.eclipse.jface.dialogs.TitleAreaDialog;
27
import org.eclipse.jface.viewers.AbstractTreeViewer;
30
import org.eclipse.jface.viewers.AbstractTreeViewer;
28
import org.eclipse.jface.viewers.ArrayContentProvider;
31
import org.eclipse.jface.viewers.ArrayContentProvider;
Lines 185-188 public abstract class AbstractCommandSelectionDialog extends TitleAreaDialog { Link Here
185
			return s;
188
			return s;
186
		}
189
		}
187
	}
190
	}
191
192
	@Override
193
	protected IDialogSettings getDialogBoundsSettings() {
194
		return ToolsEmfUiPlugin.getDefault().getDialogSettings();
195
	}
188
}
196
}
(-)a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIconDialog.java (+8 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
10
 *     Marco Descher <marco@descher.at> - Bug395283
10
 ******************************************************************************/
11
 ******************************************************************************/
11
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
13
Lines 28-39 import org.eclipse.core.resources.IResourceVisitor; Link Here
28
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.e4.tools.emf.ui.internal.Messages;
30
import org.eclipse.e4.tools.emf.ui.internal.Messages;
30
import org.eclipse.e4.tools.emf.ui.internal.StringMatcher;
31
import org.eclipse.e4.tools.emf.ui.internal.StringMatcher;
32
import org.eclipse.e4.tools.emf.ui.internal.ToolsEmfUiPlugin;
31
import org.eclipse.e4.ui.model.application.MApplicationElement;
33
import org.eclipse.e4.ui.model.application.MApplicationElement;
32
import org.eclipse.emf.common.command.Command;
34
import org.eclipse.emf.common.command.Command;
33
import org.eclipse.emf.ecore.EStructuralFeature;
35
import org.eclipse.emf.ecore.EStructuralFeature;
34
import org.eclipse.emf.edit.command.SetCommand;
36
import org.eclipse.emf.edit.command.SetCommand;
35
import org.eclipse.emf.edit.domain.EditingDomain;
37
import org.eclipse.emf.edit.domain.EditingDomain;
36
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
38
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
39
import org.eclipse.jface.dialogs.IDialogSettings;
37
import org.eclipse.jface.dialogs.TitleAreaDialog;
40
import org.eclipse.jface.dialogs.TitleAreaDialog;
38
import org.eclipse.jface.viewers.DoubleClickEvent;
41
import org.eclipse.jface.viewers.DoubleClickEvent;
39
import org.eclipse.jface.viewers.IDoubleClickListener;
42
import org.eclipse.jface.viewers.IDoubleClickListener;
Lines 315-318 public abstract class AbstractIconDialog extends TitleAreaDialog { Link Here
315
			}
318
			}
316
		}
319
		}
317
	}
320
	}
321
322
	@Override
323
	protected IDialogSettings getDialogBoundsSettings() {
324
		return ToolsEmfUiPlugin.getDefault().getDialogSettings();
325
	}
318
}
326
}
(-)a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java (-4 / +9 lines)
Lines 7-22 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
10
 *     Marco Descher <marco@descher.at> - Bug395283
10
 ******************************************************************************/
11
 ******************************************************************************/
11
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
12
13
13
import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory;
14
15
import java.util.ArrayList;
14
import java.util.ArrayList;
16
import java.util.List;
15
import java.util.List;
17
import org.eclipse.e4.tools.emf.ui.common.IModelResource;
16
import org.eclipse.e4.tools.emf.ui.common.IModelResource;
18
import org.eclipse.e4.tools.emf.ui.internal.Messages;
17
import org.eclipse.e4.tools.emf.ui.internal.Messages;
19
import org.eclipse.e4.tools.emf.ui.internal.PatternFilter;
18
import org.eclipse.e4.tools.emf.ui.internal.PatternFilter;
19
import org.eclipse.e4.tools.emf.ui.internal.ToolsEmfUiPlugin;
20
import org.eclipse.e4.tools.emf.ui.internal.common.component.ControlFactory;
20
import org.eclipse.e4.ui.model.application.commands.MCategory;
21
import org.eclipse.e4.ui.model.application.commands.MCategory;
21
import org.eclipse.e4.ui.model.application.commands.MCommand;
22
import org.eclipse.e4.ui.model.application.commands.MCommand;
22
import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
23
import org.eclipse.e4.ui.model.application.commands.impl.CommandsPackageImpl;
Lines 25-30 import org.eclipse.emf.common.util.TreeIterator; Link Here
25
import org.eclipse.emf.ecore.EObject;
26
import org.eclipse.emf.ecore.EObject;
26
import org.eclipse.emf.ecore.util.EcoreUtil;
27
import org.eclipse.emf.ecore.util.EcoreUtil;
27
import org.eclipse.emf.edit.command.SetCommand;
28
import org.eclipse.emf.edit.command.SetCommand;
29
import org.eclipse.jface.dialogs.IDialogSettings;
28
import org.eclipse.jface.dialogs.TitleAreaDialog;
30
import org.eclipse.jface.dialogs.TitleAreaDialog;
29
import org.eclipse.jface.viewers.AbstractTreeViewer;
31
import org.eclipse.jface.viewers.AbstractTreeViewer;
30
import org.eclipse.jface.viewers.ArrayContentProvider;
32
import org.eclipse.jface.viewers.ArrayContentProvider;
Lines 40-47 import org.eclipse.jface.viewers.ViewerCell; Link Here
40
import org.eclipse.swt.SWT;
42
import org.eclipse.swt.SWT;
41
import org.eclipse.swt.events.DisposeEvent;
43
import org.eclipse.swt.events.DisposeEvent;
42
import org.eclipse.swt.events.DisposeListener;
44
import org.eclipse.swt.events.DisposeListener;
43
import org.eclipse.swt.events.ModifyEvent;
44
import org.eclipse.swt.events.ModifyListener;
45
import org.eclipse.swt.graphics.Image;
45
import org.eclipse.swt.graphics.Image;
46
import org.eclipse.swt.layout.GridData;
46
import org.eclipse.swt.layout.GridData;
47
import org.eclipse.swt.layout.GridLayout;
47
import org.eclipse.swt.layout.GridLayout;
Lines 180-183 public class CommandCategorySelectionDialog extends TitleAreaDialog { Link Here
180
			return s;
180
			return s;
181
		}
181
		}
182
	}
182
	}
183
184
	@Override
185
	protected IDialogSettings getDialogBoundsSettings() {
186
		return ToolsEmfUiPlugin.getDefault().getDialogSettings();
187
	}
183
}
188
}
(-)a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionClassDialog.java (+8 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
9
 *     Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
10
 *	   Lars Vogel <lars.vogel@gmail.com> - Enhancements
10
 *	   Lars Vogel <lars.vogel@gmail.com> - Enhancements
11
 *	   Marco Descher <marco@descher.at> - Bug395283
11
 ******************************************************************************/
12
 ******************************************************************************/
12
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
13
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
13
14
Lines 18-23 import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Contributio Link Here
18
import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler;
19
import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionResultHandler;
19
import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter;
20
import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Filter;
20
import org.eclipse.e4.tools.emf.ui.internal.Messages;
21
import org.eclipse.e4.tools.emf.ui.internal.Messages;
22
import org.eclipse.e4.tools.emf.ui.internal.ToolsEmfUiPlugin;
21
import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector;
23
import org.eclipse.e4.tools.emf.ui.internal.common.ClassContributionCollector;
22
import org.eclipse.e4.ui.model.application.MApplicationElement;
24
import org.eclipse.e4.ui.model.application.MApplicationElement;
23
import org.eclipse.emf.common.command.Command;
25
import org.eclipse.emf.common.command.Command;
Lines 25-30 import org.eclipse.emf.ecore.EStructuralFeature; Link Here
25
import org.eclipse.emf.edit.command.SetCommand;
27
import org.eclipse.emf.edit.command.SetCommand;
26
import org.eclipse.emf.edit.domain.EditingDomain;
28
import org.eclipse.emf.edit.domain.EditingDomain;
27
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
29
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
30
import org.eclipse.jface.dialogs.IDialogSettings;
28
import org.eclipse.jface.dialogs.TitleAreaDialog;
31
import org.eclipse.jface.dialogs.TitleAreaDialog;
29
import org.eclipse.jface.viewers.DoubleClickEvent;
32
import org.eclipse.jface.viewers.DoubleClickEvent;
30
import org.eclipse.jface.viewers.IDoubleClickListener;
33
import org.eclipse.jface.viewers.IDoubleClickListener;
Lines 224-227 public class ContributionClassDialog extends TitleAreaDialog { Link Here
224
		}
227
		}
225
228
226
	}
229
	}
230
231
	@Override
232
	protected IDialogSettings getDialogBoundsSettings() {
233
		return ToolsEmfUiPlugin.getDefault().getDialogSettings();
234
	}
227
}
235
}

Return to bug 395283