Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonas2014-11-25 17:45:44 +0000
committerjonas2014-11-25 17:45:44 +0000
commit86c11de8fd50c2de67062bc635e76f0b7e56c914 (patch)
tree7e21fc62e21e8044ca52799b480713e0fb1e7dc9 /bundles
parent77198308c2cbc5b150125134ab3b9d51819792d4 (diff)
downloadorg.eclipse.e4.tools-86c11de8fd50c2de67062bc635e76f0b7e56c914.tar.gz
org.eclipse.e4.tools-86c11de8fd50c2de67062bc635e76f0b7e56c914.tar.xz
org.eclipse.e4.tools-86c11de8fd50c2de67062bc635e76f0b7e56c914.zip
Bug 444692 - Remove Warnings
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java11
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java37
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java28
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java43
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java55
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java43
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java98
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java67
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java90
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java8
10 files changed, 269 insertions, 211 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java
index 2fe2faaf..03c813d3 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Bug 433408, 424730
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Bug 433408, 424730
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -19,10 +19,13 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.swt.widgets.Shell;
+@SuppressWarnings("restriction")
public class AreaIconDialogEditor extends AbstractIconDialog {
- public AreaIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, EditingDomain editingDomain, MApplicationElement element, Messages Messages) {
- super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI, Messages);
+ public AreaIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project,
+ EditingDomain editingDomain, MApplicationElement element, Messages Messages) {
+ super(parentShell, context, project, editingDomain, element, UiPackageImpl.Literals.UI_LABEL__ICON_URI,
+ Messages);
}
@Override
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java
index dad7b1bc..b4918296 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java
@@ -6,13 +6,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
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;
@@ -45,11 +46,12 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+@SuppressWarnings("restriction")
public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialog {
- private IModelResource resource;
+ private final IModelResource resource;
private TableViewer viewer;
private MBindingContext selectedContext;
- private Messages Messages;
+ private final Messages Messages;
public BindingContextSelectionDialog(Shell parentShell, IModelResource resource, Messages Messages) {
super(parentShell);
@@ -63,12 +65,13 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
+ final Composite composite = (Composite) super.createDialogArea(parent);
getShell().setText(Messages.BindingContextSelectionDialog_ShellTitle);
setTitle(Messages.BindingContextSelectionDialog_Title);
setMessage(Messages.BindingContextSelectionDialog_Message);
- final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$
+ final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream(
+ "/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$
setTitleImage(titleImage);
getShell().addDisposeListener(new DisposeListener() {
@@ -78,14 +81,14 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
}
});
- Composite container = new Composite(composite, SWT.NONE);
+ final 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);
+ final Label l = new Label(container, SWT.NONE);
l.setText(Messages.BindingContextSelectionDialog_LabelContextId);
- Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH);
+ 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);
@@ -101,10 +104,10 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
}
});
- List<EObject> categories = new ArrayList<EObject>();
- TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true);
+ final List<EObject> categories = new ArrayList<EObject>();
+ final TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true);
while (it.hasNext()) {
- EObject o = it.next();
+ final EObject o = it.next();
if (o.eClass() == CommandsPackageImpl.Literals.BINDING_CONTEXT) {
categories.add(o);
}
@@ -126,9 +129,9 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
@Override
protected void okPressed() {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (!s.isEmpty()) {
- selectedContext = ((MBindingContext) s.getFirstElement());
+ selectedContext = (MBindingContext) s.getFirstElement();
if (selectedContext != null) {
super.okPressed();
} else {
@@ -141,9 +144,9 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
@Override
public void update(final ViewerCell cell) {
- MBindingContext cmd = (MBindingContext) cell.getElement();
+ final MBindingContext cmd = (MBindingContext) cell.getElement();
- StyledString styledString = new StyledString();
+ final StyledString styledString = new StyledString();
if (cmd.getName() != null) {
styledString.append(cmd.getName());
}
@@ -169,7 +172,7 @@ public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialo
@Override
public String getText(Object element) {
- MBindingContext command = (MBindingContext) element;
+ final MBindingContext command = (MBindingContext) element;
String s = ""; //$NON-NLS-1$
if (command.getName() != null) {
s += command.getName();
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java
index 470eb0aa..45f014b9 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BundleImageCache.java
@@ -6,13 +6,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Steven Spungin <steven@spungin.tv> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
+
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.tools.services.IResourcePool;
import org.eclipse.swt.graphics.Image;
@@ -34,11 +35,11 @@ import org.eclipse.swt.widgets.Display;
*/
public class BundleImageCache {
- private Display display;
- private ClassLoader classloader;
+ private final Display display;
+ private final ClassLoader classloader;
ArrayList<Image> images;
static private Image imgPlaceholder;
- private IEclipseContext context;
+ private final IEclipseContext context;
public BundleImageCache(Display display, ClassLoader classloader) {
this(display, classloader, null);
@@ -55,14 +56,14 @@ public class BundleImageCache {
* Creates the image, and tracks it for a bulk dispose operation.
*
* @param path
- * @return
+ * @return the {@link Image}
*/
public Image create(String path) {
Image img;
try {
img = new Image(display, classloader.getResourceAsStream(path));
images.add(img);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
img = getPlaceholder();
}
@@ -71,15 +72,15 @@ public class BundleImageCache {
/**
* Uses IResourcePool to obtain image. Does not track object.
- *
+ *
* @param key
- * @return
+ * @return The {@link Image}
*/
public Image loadFromKey(String key) {
Image ret = null;
try {
ret = context.get(IResourcePool.class).getImageUnchecked(key);
- } catch (Exception ex) {
+ } catch (final Exception ex) {
ex.printStackTrace();
}
if (ret == null) {
@@ -90,7 +91,8 @@ public class BundleImageCache {
protected Image getPlaceholder() {
if (imgPlaceholder == null) {
- imgPlaceholder = new Image(Display.getDefault(), classloader.getResourceAsStream("/icons/full/obj16/missing_image_placeholder.png")); //$NON-NLS-1$
+ imgPlaceholder = new Image(Display.getDefault(),
+ classloader.getResourceAsStream("/icons/full/obj16/missing_image_placeholder.png")); //$NON-NLS-1$
}
return imgPlaceholder;
}
@@ -103,8 +105,8 @@ public class BundleImageCache {
}
public void dispose() {
- for (Iterator<Image> it = images.iterator(); it.hasNext();) {
- Image image = it.next();
+ for (final Iterator<Image> it = images.iterator(); it.hasNext();) {
+ final Image image = it.next();
if (image.isDisposed() == false) {
image.dispose();
}
@@ -120,7 +122,7 @@ public class BundleImageCache {
try {
img = new Image(display, new URL("platform:/plugin/" + bundleId + path).openStream()); //$NON-NLS-1$
images.add(img);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
img = getPlaceholder();
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java
index 72112954..83f71d94 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java
@@ -6,13 +6,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
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;
@@ -48,13 +49,15 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+@SuppressWarnings("restriction")
public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDialog {
- private IModelResource resource;
+ private final IModelResource resource;
private TableViewer viewer;
- private MCommand command;
- private Messages Messages;
+ private final MCommand command;
+ private final Messages Messages;
- public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command, Messages Messages) {
+ public CommandCategorySelectionDialog(Shell parentShell, IModelResource resource, MCommand command,
+ Messages Messages) {
super(parentShell);
this.resource = resource;
this.command = command;
@@ -63,12 +66,13 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
@Override
protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
+ final Composite composite = (Composite) super.createDialogArea(parent);
getShell().setText(Messages.CommandCategorySelectionDialog_ShellTitle);
setTitle(Messages.CommandCategorySelectionDialog_Title);
setMessage(Messages.CommandCategorySelectionDialog_Message);
- final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$
+ final Image titleImage = new Image(composite.getDisplay(), getClass().getClassLoader().getResourceAsStream(
+ "/icons/full/wizban/newexp_wiz.png")); //$NON-NLS-1$
setTitleImage(titleImage);
getShell().addDisposeListener(new DisposeListener() {
@@ -78,14 +82,14 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
}
});
- Composite container = new Composite(composite, SWT.NONE);
+ final 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);
+ final Label l = new Label(container, SWT.NONE);
l.setText(Messages.CommandCategorySelectionDialog_LabelCategoryId);
- Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH);
+ 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);
@@ -101,10 +105,10 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
}
});
- List<EObject> categories = new ArrayList<EObject>();
- TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true);
+ final List<EObject> categories = new ArrayList<EObject>();
+ final TreeIterator<EObject> it = EcoreUtil.getAllContents((EObject) resource.getRoot().get(0), true);
while (it.hasNext()) {
- EObject o = it.next();
+ final EObject o = it.next();
if (o.eClass() == CommandsPackageImpl.Literals.CATEGORY) {
categories.add(o);
}
@@ -126,9 +130,10 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
@Override
protected void okPressed() {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (!s.isEmpty()) {
- Command cmd = SetCommand.create(resource.getEditingDomain(), command, CommandsPackageImpl.Literals.COMMAND__CATEGORY, s.getFirstElement());
+ final Command cmd = SetCommand.create(resource.getEditingDomain(), command,
+ CommandsPackageImpl.Literals.COMMAND__CATEGORY, s.getFirstElement());
if (cmd.canExecute()) {
resource.getEditingDomain().getCommandStack().execute(cmd);
super.okPressed();
@@ -140,9 +145,9 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
@Override
public void update(final ViewerCell cell) {
- MCategory cmd = (MCategory) cell.getElement();
+ final MCategory cmd = (MCategory) cell.getElement();
- StyledString styledString = new StyledString();
+ final StyledString styledString = new StyledString();
if (cmd.getName() != null) {
styledString.append(cmd.getName());
}
@@ -165,7 +170,7 @@ public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDial
@Override
public String getText(Object element) {
- MCategory command = (MCategory) element;
+ final MCategory command = (MCategory) element;
String s = ""; //$NON-NLS-1$
if (command.getName() != null) {
s += command.getName();
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
index 2750f613..82461709 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ContributionDataFile.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730
+ * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -22,6 +22,7 @@ import java.net.URL;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
@@ -53,13 +54,13 @@ import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.Contributio
*/
public class ContributionDataFile implements IFile {
- private ContributionData data;
+ private final ContributionData data;
private IPath path;
public ContributionDataFile(ContributionData data) {
this.data = data;
if (data.iconPath != null) {
- this.path = Path.fromOSString(data.iconPath);
+ path = Path.fromOSString(data.iconPath);
}
}
@@ -75,9 +76,8 @@ public class ContributionDataFile implements IFile {
public IPath getProjectRelativePath() {
if (getContributionData().installLocation != null) {
return new Path(data.resourceRelativePath);
- } else {
- return new Path(data.iconPath);
}
+ return new Path(data.iconPath);
}
@Override
@@ -349,6 +349,7 @@ public class ContributionDataFile implements IFile {
return false;
}
+ @Deprecated
@Override
public boolean isLocal(int depth) {
// TODO Auto-generated method stub
@@ -392,7 +393,8 @@ public class ContributionDataFile implements IFile {
}
@Override
- public void move(IProjectDescription description, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
+ public void move(IProjectDescription description, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ throws CoreException {
// TODO Auto-generated method stub
}
@@ -415,6 +417,7 @@ public class ContributionDataFile implements IFile {
}
+ @Deprecated
@Override
public void setDerived(boolean isDerived) throws CoreException {
// TODO Auto-generated method stub
@@ -433,6 +436,7 @@ public class ContributionDataFile implements IFile {
}
+ @Deprecated
@Override
public void setLocal(boolean flag, int depth, IProgressMonitor monitor) throws CoreException {
// TODO Auto-generated method stub
@@ -451,6 +455,7 @@ public class ContributionDataFile implements IFile {
}
+ @Deprecated
@Override
public void setReadOnly(boolean readOnly) {
// TODO Auto-generated method stub
@@ -500,7 +505,8 @@ public class ContributionDataFile implements IFile {
}
@Override
- public void appendContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
+ public void appendContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ throws CoreException {
// TODO Auto-generated method stub
}
@@ -579,20 +585,20 @@ public class ContributionDataFile implements IFile {
entry = zip.getEntry(data.iconPath);
}
return zip.getInputStream(entry);
- } else {
- url = new URL("platform:/plugin/" + data.bundleName + "/" + data.iconPath); //$NON-NLS-1$ //$NON-NLS-2$
- InputStream ret;
- try {
- ret = url.openStream();
- } catch (Exception e) {
- return new BufferedInputStream(new FileInputStream(data.installLocation + "/" + data.resourceRelativePath)); //$NON-NLS-1$
- }
- return ret;
}
- } catch (MalformedURLException e) {
+ url = new URL("platform:/plugin/" + data.bundleName + "/" + data.iconPath); //$NON-NLS-1$ //$NON-NLS-2$
+ InputStream ret;
+ try {
+ ret = url.openStream();
+ } catch (final Exception e) {
+ return new BufferedInputStream(new FileInputStream(data.installLocation
+ + "/" + data.resourceRelativePath)); //$NON-NLS-1$
+ }
+ return ret;
+ } catch (final MalformedURLException e) {
e.printStackTrace();
throw new CoreException(Status.CANCEL_STATUS);
- } catch (IOException e) {
+ } catch (final IOException e) {
// perhaps not a bundle
// e.printStackTrace();
throw new CoreException(Status.CANCEL_STATUS);
@@ -600,7 +606,7 @@ public class ContributionDataFile implements IFile {
if (zip != null) {
try {
zip.close();
- } catch (IOException e) {
+ } catch (final IOException e) {
}
}
}
@@ -612,6 +618,7 @@ public class ContributionDataFile implements IFile {
return null;
}
+ @Deprecated
@Override
public int getEncoding() throws CoreException {
// TODO Auto-generated method stub
@@ -642,11 +649,13 @@ public class ContributionDataFile implements IFile {
}
@Override
- public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
+ public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ throws CoreException {
// TODO Auto-generated method stub
}
+ @Deprecated
@Override
public void setCharset(String newCharset) throws CoreException {
// TODO Auto-generated method stub
@@ -660,13 +669,15 @@ public class ContributionDataFile implements IFile {
}
@Override
- public void setContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
+ public void setContents(InputStream source, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ throws CoreException {
// TODO Auto-generated method stub
}
@Override
- public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException {
+ public void setContents(IFileState source, boolean force, boolean keepHistory, IProgressMonitor monitor)
+ throws CoreException {
// TODO Auto-generated method stub
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java
index 4e3db84a..f3f859b4 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java
@@ -6,13 +6,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.e4.tools.emf.ui.common.IExtensionLookup;
@@ -45,15 +46,17 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+@SuppressWarnings("restriction")
public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
- private IExtensionLookup lookup;
+ private final IExtensionLookup lookup;
private TableViewer viewer;
- private EditingDomain domain;
- private MCoreExpression expression;
- private boolean liveModel;
- private Messages Messages;
+ private final EditingDomain domain;
+ private final MCoreExpression expression;
+ private final boolean liveModel;
+ private final Messages Messages;
- public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression, EditingDomain domain, boolean liveModel, Messages Messages) {
+ public ExpressionIdDialog(Shell parentShell, IExtensionLookup lookup, MCoreExpression expression,
+ EditingDomain domain, boolean liveModel, Messages Messages) {
super(parentShell);
this.lookup = lookup;
this.expression = expression;
@@ -67,15 +70,15 @@ public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
getShell().setText(Messages.ExpressionIdDialog_ShellTitle);
setTitle(Messages.ExpressionIdDialog_DialogTitle);
setMessage(Messages.ExpressionIdDialog_DialogMessage);
- Composite comp = (Composite) super.createDialogArea(parent);
- Composite container = new Composite(comp, SWT.NONE);
+ final Composite comp = (Composite) super.createDialogArea(parent);
+ final 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.ExpressionIdDialog_Id);
- Text idField = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH);
+ final Text idField = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH);
idField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final PatternFilter filter = new PatternFilter() {
@@ -108,8 +111,10 @@ public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
@Override
protected void okPressed() {
if (!viewer.getSelection().isEmpty()) {
- IConfigurationElement el = (IConfigurationElement) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
- Command cmd = SetCommand.create(domain, expression, UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID, el.getAttribute("id")); //$NON-NLS-1$
+ final IConfigurationElement el = (IConfigurationElement) ((IStructuredSelection) viewer.getSelection())
+ .getFirstElement();
+ final Command cmd = SetCommand.create(domain, expression,
+ UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID, el.getAttribute("id")); //$NON-NLS-1$
if (cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
super.okPressed();
@@ -118,9 +123,9 @@ public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
}
private List<IConfigurationElement> getElements(IExtensionLookup lookup) {
- List<IConfigurationElement> list = new ArrayList<IConfigurationElement>();
- for (IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions", liveModel)) { //$NON-NLS-1$
- for (IConfigurationElement el : ext.getConfigurationElements()) {
+ final List<IConfigurationElement> list = new ArrayList<IConfigurationElement>();
+ for (final IExtension ext : lookup.findExtensions("org.eclipse.core.expressions.definitions", liveModel)) { //$NON-NLS-1$
+ for (final IConfigurationElement el : ext.getConfigurationElements()) {
list.add(el);
}
}
@@ -130,8 +135,8 @@ public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
static class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider {
@Override
public void update(ViewerCell cell) {
- IConfigurationElement el = (IConfigurationElement) cell.getElement();
- StyledString str = new StyledString(el.getAttribute("id")); //$NON-NLS-1$
+ final IConfigurationElement el = (IConfigurationElement) cell.getElement();
+ final StyledString str = new StyledString(el.getAttribute("id")); //$NON-NLS-1$
str.append(" - " + el.getContributor().getName(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$
cell.setText(str.getString());
cell.setStyleRanges(str.getStyleRanges());
@@ -144,7 +149,7 @@ public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog {
@Override
public String getText(Object element) {
- IConfigurationElement el = (IConfigurationElement) element;
+ final IConfigurationElement el = (IConfigurationElement) element;
return el.getAttribute("id") + " " + el.getContributor().getName(); //$NON-NLS-1$//$NON-NLS-2$
}
}
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
index 9f3918f8..866fcd9f 100644
--- 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
@@ -6,14 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
import java.text.BreakIterator;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.e4.tools.emf.ui.common.Util;
import org.eclipse.e4.tools.emf.ui.common.Util.InternalClass;
import org.eclipse.e4.tools.emf.ui.common.Util.InternalFeature;
@@ -58,14 +59,16 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+@SuppressWarnings("restriction")
public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
private TreeViewer viewer;
- private MStringModelFragment fragment;
- private EditingDomain editingDomain;
- private Messages Messages;
+ private final MStringModelFragment fragment;
+ private final EditingDomain editingDomain;
+ private final Messages Messages;
private ViewerFilterImpl filter;
- public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment, Messages Messages) {
+ public FeatureSelectionDialog(Shell parentShell, EditingDomain editingDomain, MStringModelFragment fragment,
+ Messages Messages) {
super(parentShell);
this.fragment = fragment;
this.editingDomain = editingDomain;
@@ -83,12 +86,16 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
setTitle(Messages.FeatureSelectionDialog_DialogTitle);
setMessage(Messages.FeatureSelectionDialog_DialogMessage);
- Composite composite = (Composite) super.createDialogArea(parent);
+ final 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$
+ 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);
@@ -103,11 +110,11 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
}
});
- Composite container = new Composite(composite, SWT.NONE);
+ final 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);
+ final 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);
@@ -132,7 +139,7 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
});
new Label(container, SWT.NONE);
viewer = new TreeViewer(container);
- GridData gd = new GridData(GridData.FILL_BOTH);
+ final GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
viewer.getControl().setLayoutData(gd);
viewer.setContentProvider(new ContentProviderImpl());
@@ -148,7 +155,8 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
@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());
+ 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) {
@@ -160,12 +168,13 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Button buttonOk = getButton(IDialogConstants.OK_ID);
- if (!selection.isEmpty() && selection.getFirstElement().getClass() == InternalFeature.class)
+ final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ final Button buttonOk = getButton(IDialogConstants.OK_ID);
+ if (!selection.isEmpty() && selection.getFirstElement().getClass() == InternalFeature.class) {
buttonOk.setEnabled(true);
- else
+ } else {
buttonOk.setEnabled(false);
+ }
}
});
@@ -180,10 +189,11 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
@Override
protected void okPressed() {
- IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
+ final 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());
+ final InternalFeature f = (InternalFeature) sel.getFirstElement();
+ final Command cmd = SetCommand.create(editingDomain, fragment,
+ FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME, f.feature.getName());
if (cmd.canExecute()) {
editingDomain.getCommandStack().execute(cmd);
@@ -250,21 +260,21 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
@Override
public void update(final ViewerCell cell) {
if (cell.getElement().getClass() == InternalPackage.class) {
- InternalPackage o = (InternalPackage) cell.getElement();
- StyledString styledString = new StyledString(o.ePackage.getName());
+ final InternalPackage o = (InternalPackage) cell.getElement();
+ final 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();
+ final 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());
+ final InternalFeature o = (InternalFeature) cell.getElement();
+ final StyledString styledString = new StyledString(o.feature.getName());
- EClassifier type = ModelUtils.getTypeArgument(o.clazz.eClass, o.feature.getEGenericType());
+ final 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 {
@@ -285,13 +295,13 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
@Override
public String getText(Object element) {
if (element.getClass() == InternalPackage.class) {
- InternalPackage o = (InternalPackage) element;
+ final InternalPackage o = (InternalPackage) element;
return o.ePackage.getName();
} else if (element.getClass() == InternalClass.class) {
- InternalClass o = (InternalClass) element;
+ final InternalClass o = (InternalClass) element;
return o.eClass.getName();
} else {
- InternalFeature o = (InternalFeature) element;
+ final InternalFeature o = (InternalFeature) element;
return o.feature.getName();
}
}
@@ -303,14 +313,14 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- ILabelProvider pv = (ILabelProvider) ((StructuredViewer) viewer).getLabelProvider();
+ final ILabelProvider pv = (ILabelProvider) ((StructuredViewer) viewer).getLabelProvider();
if (element.getClass() == InternalPackage.class) {
- for (InternalClass c : ((InternalPackage) element).classes) {
+ for (final InternalClass c : ((InternalPackage) element).classes) {
if (match(pv.getText(c))) {
return true;
}
- for (InternalFeature f : c.features) {
+ for (final InternalFeature f : c.features) {
if (match(pv.getText(f))) {
return true;
}
@@ -321,7 +331,7 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
if (match(pv.getText(element))) {
return true;
}
- for (InternalFeature f : ((InternalClass) element).features) {
+ for (final InternalFeature f : ((InternalClass) element).features) {
if (match(pv.getText(f))) {
return true;
}
@@ -344,9 +354,9 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
}
// Otherwise check if any of the words of the text matches
- String[] words = getWords(text);
+ final String[] words = getWords(text);
for (int i = 0; i < words.length; i++) {
- String word = words[i];
+ final String word = words[i];
if (match(word)) {
return true;
}
@@ -357,10 +367,10 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
/**
* 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) {
@@ -373,7 +383,7 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
/**
* The pattern string for which this filter should select elements in
* the viewer.
- *
+ *
* @param patternString
*/
public void setPattern(String patternString) {
@@ -392,12 +402,12 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
/**
* 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>();
+ final 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
@@ -408,7 +418,7 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
// Also need to do this in an NL-sensitive way. The use of
// BreakIterator
// was suggested in bug 90579.
- BreakIterator iter = BreakIterator.getWordInstance();
+ final BreakIterator iter = BreakIterator.getWordInstance();
iter.setText(text);
int i = iter.first();
while (i != java.text.BreakIterator.DONE && i < text.length()) {
@@ -418,7 +428,7 @@ public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog {
}
// match the word
if (Character.isLetterOrDigit(text.charAt(i))) {
- String word = text.substring(i, j);
+ final String word = text.substring(i, j);
words.add(word);
}
i = j;
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
index c4de6769..25e5a20d 100644
--- 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
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -53,11 +53,12 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
+@SuppressWarnings("restriction")
public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
- private EObject element;
- private AbstractComponentEditor editor;
+ private final EObject element;
+ private final AbstractComponentEditor editor;
private TableViewer viewer;
- private Messages Messages;
+ private final Messages Messages;
public FindImportElementDialog(Shell parentShell, AbstractComponentEditor editor, EObject element, Messages Messages) {
super(parentShell);
@@ -68,9 +69,10 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
@Override
protected Control createDialogArea(Composite parent) {
- Composite comp = (Composite) super.createDialogArea(parent);
+ final Composite comp = (Composite) super.createDialogArea(parent);
- final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$
+ final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream(
+ "/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$
setTitleImage(titleImage);
getShell().addDisposeListener(new DisposeListener() {
@@ -84,7 +86,7 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
setTitle(Messages.FindImportElementDialog_Title);
setMessage(Messages.FindImportElementDialog_Message);
- Composite container = new Composite(comp, SWT.NONE);
+ final Composite container = new Composite(comp, SWT.NONE);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
container.setLayout(new GridLayout(2, false));
@@ -104,12 +106,14 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
viewer.setLabelProvider(new StyledCellLabelProvider() {
@Override
public void update(ViewerCell cell) {
- EObject o = (EObject) cell.getElement();
+ final EObject o = (EObject) cell.getElement();
cell.setImage(editor.getImage(o, searchText.getDisplay()));
- MApplicationElement appEl = (MApplicationElement) o;
- StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String detailLabel = editor.getDetailLabel(o);
+ final MApplicationElement appEl = (MApplicationElement) o;
+ final StyledString styledString = new StyledString(
+ editor.getLabel(o)
+ + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ final String detailLabel = editor.getDetailLabel(o);
if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) {
styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$
}
@@ -142,13 +146,13 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
currentResultHandler.cancled = true;
}
list.clear();
- Filter filter = new Filter(element.eClass(), searchText.getText());
+ final Filter filter = new Filter(element.eClass(), searchText.getText());
currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, element.eResource());
collector.findModelElements(filter, currentResultHandler);
}
});
- Button button = new Button(container, SWT.PUSH);
+ final Button button = new Button(container, SWT.PUSH);
button.setText(Messages.FindImportElementDialog_ClearCache);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1));
button.addSelectionListener(new SelectionAdapter() {
@@ -163,11 +167,12 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
@Override
protected void okPressed() {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (!s.isEmpty()) {
- MApplicationElement el = (MApplicationElement) s.getFirstElement();
+ final MApplicationElement el = (MApplicationElement) s.getFirstElement();
if (el.getElementId() != null && el.getElementId().trim().length() > 0) {
- Command cmd = SetCommand.create(editor.getEditingDomain(), element, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, el.getElementId());
+ final Command cmd = SetCommand.create(editor.getEditingDomain(), element,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, el.getElementId());
if (cmd.canExecute()) {
editor.getEditingDomain().getCommandStack().execute(cmd);
super.okPressed();
@@ -179,9 +184,9 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
}
private ClassContributionCollector getCollector() {
- Bundle bundle = FrameworkUtil.getBundle(FindImportElementDialog.class);
- BundleContext context = bundle.getBundleContext();
- ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName());
+ final Bundle bundle = FrameworkUtil.getBundle(FindImportElementDialog.class);
+ final BundleContext context = bundle.getBundleContext();
+ final ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName());
if (ref != null) {
return (ClassContributionCollector) context.getService(ref);
}
@@ -190,12 +195,13 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
private static class ModelResultHandlerImpl implements ModelResultHandler {
private boolean cancled = false;
- private IObservableList list;
- private Filter filter;
- private AbstractComponentEditor editor;
- private Resource resource;
+ private final IObservableList list;
+ private final Filter filter;
+ private final AbstractComponentEditor editor;
+ private final Resource resource;
- public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, Resource resource) {
+ public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor,
+ Resource resource) {
this.list = list;
this.filter = filter;
this.editor = editor;
@@ -205,28 +211,29 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog {
@Override
public void result(EObject data) {
if (!cancled) {
- if (!resource.getURI().equals(data.eResource().getURI()))
+ if (!resource.getURI().equals(data.eResource().getURI())) {
if (data instanceof MApplicationElement) {
- String elementId = ((MApplicationElement) data).getElementId();
+ final String elementId = ((MApplicationElement) data).getElementId();
if (elementId == null) {
list.add(data);
return;
}
- if (elementId != null && elementId.trim().length() > 0) {
+ if (elementId.trim().length() > 0) {
if (filter.elementIdPattern.matcher(elementId).matches()) {
list.add(data);
return;
}
}
- String label = editor.getDetailLabel(data);
- if (elementId != null && label != null && label.trim().length() > 0) {
+ final String label = editor.getDetailLabel(data);
+ if (label != null && label.trim().length() > 0) {
if (filter.elementIdPattern.matcher(label).matches()) {
list.add(data);
}
}
}
+ }
}
}
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java
index 60472752..e8d15918 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java
@@ -6,14 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Bug 437469
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Bug 437469
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.e4.tools.emf.ui.common.IModelElementProvider.Filter;
@@ -72,17 +73,19 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceReference;
+@SuppressWarnings("restriction")
public class FindParentReferenceElementDialog extends TitleAreaDialog {
- private MStringModelFragment fragment;
- private AbstractComponentEditor editor;
+ private final MStringModelFragment fragment;
+ private final AbstractComponentEditor editor;
private TableViewer viewer;
- private Messages Messages;
+ private final Messages Messages;
private ModelResultHandlerImpl currentResultHandler;
private WritableList list;
private ComboViewer eClassViewer;
private Text searchText;
- public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor, MStringModelFragment fragment, Messages Messages) {
+ public FindParentReferenceElementDialog(Shell parentShell, AbstractComponentEditor editor,
+ MStringModelFragment fragment, Messages Messages) {
super(parentShell);
this.fragment = fragment;
this.editor = editor;
@@ -96,9 +99,10 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
@Override
protected Control createDialogArea(Composite parent) {
- Composite comp = (Composite) super.createDialogArea(parent);
+ final Composite comp = (Composite) super.createDialogArea(parent);
- final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream("/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$
+ final Image titleImage = new Image(parent.getDisplay(), getClass().getClassLoader().getResourceAsStream(
+ "/icons/full/wizban/import_wiz.png")); //$NON-NLS-1$
setTitleImage(titleImage);
getShell().addDisposeListener(new DisposeListener() {
@@ -112,14 +116,14 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
setTitle(Messages.FindParentReferenceElementDialog_Title);
setMessage(Messages.FindParentReferenceElementDialog_Message);
- Composite container = new Composite(comp, SWT.NONE);
+ final 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.FindParentReferenceElementDialog_ContainerType);
- Combo combo = new Combo(container, SWT.NONE);
+ final Combo combo = new Combo(container, SWT.NONE);
eClassViewer = new ComboViewer(combo);
eClassViewer.setLabelProvider(new LabelProvider() {
@Override
@@ -129,14 +133,14 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
});
eClassViewer.setContentProvider(new ArrayContentProvider());
final List<EClass> eClassList = new ArrayList<EClass>();
- for (InternalPackage p : Util.loadPackages()) {
+ for (final InternalPackage p : Util.loadPackages()) {
eClassList.addAll(p.getAllClasses());
}
eClassViewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- EClass ec1 = (EClass) e1;
- EClass ec2 = (EClass) e2;
+ final EClass ec1 = (EClass) e1;
+ final EClass ec2 = (EClass) e2;
return ec1.getName().compareTo(ec2.getName());
}
});
@@ -151,17 +155,17 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
}
});
- ArrayList<String> vals = new ArrayList<String>();
- for (EClass item : eClassList) {
+ final ArrayList<String> vals = new ArrayList<String>();
+ for (final EClass item : eClassList) {
vals.add(item.getName());
}
final String[] values = vals.toArray(new String[0]);
- ComboContentAdapter textContentAdapter = new ComboContentAdapter() {
+ final ComboContentAdapter textContentAdapter = new ComboContentAdapter() {
@Override
public void setControlContents(Control control, String text1, int cursorPosition) {
super.setControlContents(control, text1, cursorPosition);
- int index = Arrays.asList(values).indexOf(text1);
- EClass eClass = eClassList.get(index);
+ final int index = Arrays.asList(values).indexOf(text1);
+ final EClass eClass = eClassList.get(index);
eClassViewer.setSelection(new StructuredSelection(eClass));
}
};
@@ -183,14 +187,17 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
viewer.setLabelProvider(new StyledCellLabelProvider() {
@Override
public void update(ViewerCell cell) {
- EObject o = (EObject) cell.getElement();
- AbstractComponentEditor editor = FindParentReferenceElementDialog.this.editor.getEditor().getEditor(o.eClass());
+ final EObject o = (EObject) cell.getElement();
+ final AbstractComponentEditor editor = FindParentReferenceElementDialog.this.editor.getEditor()
+ .getEditor(o.eClass());
cell.setImage(editor.getImage(o, searchText.getDisplay()));
- MApplicationElement appEl = (MApplicationElement) o;
+ final MApplicationElement appEl = (MApplicationElement) o;
- StyledString styledString = new StyledString(editor.getLabel(o) + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String detailLabel = editor.getDetailLabel(o);
+ final StyledString styledString = new StyledString(
+ editor.getLabel(o)
+ + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ final String detailLabel = editor.getDetailLabel(o);
if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) {
styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$
}
@@ -222,7 +229,7 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
}
});
- Button button = new Button(container, SWT.PUSH);
+ final Button button = new Button(container, SWT.PUSH);
button.setText(Messages.FindParentReferenceElementDialog_ClearCache);
button.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false, 2, 1));
button.addSelectionListener(new SelectionAdapter() {
@@ -240,7 +247,8 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
}
list.clear();
- Filter filter = new Filter((EClass) ((IStructuredSelection) eClassViewer.getSelection()).getFirstElement(), searchText.getText());
+ final Filter filter = new Filter(
+ (EClass) ((IStructuredSelection) eClassViewer.getSelection()).getFirstElement(), searchText.getText());
currentResultHandler = new ModelResultHandlerImpl(list, filter, editor, ((EObject) fragment).eResource());
getCollector().findModelElements(filter, currentResultHandler);
@@ -249,11 +257,12 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
@Override
protected void okPressed() {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (!s.isEmpty()) {
- MApplicationElement el = (MApplicationElement) s.getFirstElement();
+ final MApplicationElement el = (MApplicationElement) s.getFirstElement();
if (el.getElementId() != null && el.getElementId().trim().length() > 0) {
- Command cmd = SetCommand.create(editor.getEditingDomain(), fragment, FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID, el.getElementId());
+ final Command cmd = SetCommand.create(editor.getEditingDomain(), fragment,
+ FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID, el.getElementId());
if (cmd.canExecute()) {
editor.getEditingDomain().getCommandStack().execute(cmd);
super.okPressed();
@@ -265,9 +274,9 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
}
private ClassContributionCollector getCollector() {
- Bundle bundle = FrameworkUtil.getBundle(FindParentReferenceElementDialog.class);
- BundleContext context = bundle.getBundleContext();
- ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName());
+ final Bundle bundle = FrameworkUtil.getBundle(FindParentReferenceElementDialog.class);
+ final BundleContext context = bundle.getBundleContext();
+ final ServiceReference<?> ref = context.getServiceReference(ClassContributionCollector.class.getName());
if (ref != null) {
return (ClassContributionCollector) context.getService(ref);
}
@@ -276,12 +285,13 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
private static class ModelResultHandlerImpl implements ModelResultHandler {
private boolean cancled = false;
- private IObservableList list;
- private Filter filter;
- private AbstractComponentEditor editor;
- private Resource resource;
+ private final IObservableList list;
+ private final Filter filter;
+ private final AbstractComponentEditor editor;
+ private final Resource resource;
- public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor, Resource resource) {
+ public ModelResultHandlerImpl(IObservableList list, Filter filter, AbstractComponentEditor editor,
+ Resource resource) {
this.list = list;
this.filter = filter;
this.editor = editor;
@@ -293,21 +303,21 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog {
if (!cancled) {
if (!resource.getURI().equals(data.eResource().getURI())) {
if (data instanceof MApplicationElement) {
- String elementId = ((MApplicationElement) data).getElementId();
+ final String elementId = ((MApplicationElement) data).getElementId();
if (elementId == null) {
list.add(data);
return;
}
- if (elementId != null && elementId.trim().length() > 0) {
+ if (elementId.trim().length() > 0) {
if (filter.elementIdPattern.matcher(elementId).matches()) {
list.add(data);
return;
}
}
- String label = editor.getDetailLabel(data);
- if (elementId != null && label != null && label.trim().length() > 0) {
+ final String label = editor.getDetailLabel(data);
+ if (label != null && label.trim().length() > 0) {
if (filter.elementIdPattern.matcher(label).matches()) {
list.add(data);
return;
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
index a2ae60fe..1fb224d4 100644
--- 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
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -20,10 +20,12 @@ import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.swt.widgets.Shell;
+@SuppressWarnings("restriction")
public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog {
- private MHandledItem handler;
+ private final MHandledItem handler;
- public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, Messages Messages) {
+ public HandledMenuItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource,
+ Messages Messages) {
super(parentShell, resource, Messages);
this.handler = handler;
}

Back to the top