Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.releng.preferences.editor')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/OpenEditorAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/ShowInExplorerAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/AllPreferencesPreferencePage.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditor.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditorPlugin.java25
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesModelWizard.java223
7 files changed, 190 insertions, 186 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/OpenEditorAction.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/OpenEditorAction.java
index 48d0e9a14a..6df2afe9a2 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/OpenEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/OpenEditorAction.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2002-2006 IBM Corporation and others.
+ * Copyright (c) 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/ShowInExplorerAction.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/ShowInExplorerAction.java
index c475e98cee..b8a187319a 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/ShowInExplorerAction.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/action/ShowInExplorerAction.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2002-2006 IBM Corporation and others.
+ * Copyright (c) 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/AllPreferencesPreferencePage.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/AllPreferencesPreferencePage.java
index b7d14eeee5..7d47dca09b 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/AllPreferencesPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/AllPreferencesPreferencePage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Eike Stepper (Berlin, Germany) and others.
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
index 9cc4e96326..cf0c3dc491 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
@@ -1,15 +1,18 @@
-/**
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
*/
package org.eclipse.emf.cdo.releng.preferences.presentation;
-import java.util.ArrayList;
-import java.util.Collection;
-
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-
import org.eclipse.emf.edit.ui.action.ControlAction;
import org.eclipse.emf.edit.ui.action.CreateChildAction;
import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
@@ -28,26 +31,26 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.SubContributionItem;
-
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
-
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import java.util.ArrayList;
+import java.util.Collection;
+
/**
* This is the action bar contributor for the Preferences model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
-public class PreferencesActionBarContributor
- extends EditingDomainActionBarContributor
- implements ISelectionChangedListener
+public class PreferencesActionBarContributor extends EditingDomainActionBarContributor implements
+ ISelectionChangedListener
{
/**
* This keeps track of the active editor.
@@ -71,22 +74,22 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected IAction showPropertiesViewAction =
- new Action(PreferencesEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
+ protected IAction showPropertiesViewAction = new Action(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
+ {
+ @Override
+ public void run()
{
- @Override
- public void run()
+ try
{
- try
- {
- getPage().showView("org.eclipse.ui.views.PropertySheet");
- }
- catch (PartInitException exception)
- {
- PreferencesEditorPlugin.INSTANCE.log(exception);
- }
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
}
- };
+ catch (PartInitException exception)
+ {
+ PreferencesEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
/**
* This action refreshes the viewer of the current editor if the editor
@@ -95,28 +98,28 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected IAction refreshViewerAction =
- new Action(PreferencesEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
+ protected IAction refreshViewerAction = new Action(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
+ {
+ @Override
+ public boolean isEnabled()
{
- @Override
- public boolean isEnabled()
- {
- return activeEditorPart instanceof IViewerProvider;
- }
+ return activeEditorPart instanceof IViewerProvider;
+ }
- @Override
- public void run()
+ @Override
+ public void run()
+ {
+ if (activeEditorPart instanceof IViewerProvider)
{
- if (activeEditorPart instanceof IViewerProvider)
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null)
{
- Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
- if (viewer != null)
- {
- viewer.refresh();
- }
+ viewer.refresh();
}
}
- };
+ }
+ };
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
@@ -191,7 +194,9 @@ public class PreferencesActionBarContributor
{
super.contributeToMenu(menuManager);
- IMenuManager submenuManager = new MenuManager(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditor_menu"), "org.eclipse.emf.cdo.releng.preferencesMenuID");
+ IMenuManager submenuManager = new MenuManager(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditor_menu"),
+ "org.eclipse.emf.cdo.releng.preferencesMenuID");
menuManager.insertAfter("additions", submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
@@ -205,19 +210,19 @@ public class PreferencesActionBarContributor
// Prepare for CreateSibling item addition or removal.
//
- createSiblingMenuManager = new MenuManager(PreferencesEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ createSiblingMenuManager = new MenuManager(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
submenuManager.insertBefore("additions", createSiblingMenuManager);
// Force an update because Eclipse hides empty menus now.
//
- submenuManager.addMenuListener
- (new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager menuManager)
- {
- menuManager.updateAll(true);
- }
- });
+ submenuManager.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager menuManager)
+ {
+ menuManager.updateAll(true);
+ }
+ });
addGlobalActions(submenuManager);
}
@@ -361,7 +366,8 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID)
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions,
+ String contributionID)
{
if (actions != null)
{
@@ -378,7 +384,7 @@ public class PreferencesActionBarContributor
}
}
}
-
+
/**
* This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
@@ -448,7 +454,7 @@ public class PreferencesActionBarContributor
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter("ui-actions", showPropertiesViewAction);
- refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditor.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditor.java
index 32f6f1e0d6..ba9f53146d 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditor.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditor.java
@@ -1,4 +1,12 @@
-/**
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
*/
package org.eclipse.emf.cdo.releng.preferences.presentation;
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditorPlugin.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditorPlugin.java
index 39806b2150..0a3c830ade 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditorPlugin.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesEditorPlugin.java
@@ -1,11 +1,17 @@
-/**
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
*/
package org.eclipse.emf.cdo.releng.preferences.presentation;
import org.eclipse.emf.common.EMFPlugin;
-
import org.eclipse.emf.common.ui.EclipseUIPlugin;
-
import org.eclipse.emf.common.util.ResourceLocator;
/**
@@ -23,7 +29,7 @@ public final class PreferencesEditorPlugin extends EMFPlugin
* @generated
*/
public static final PreferencesEditorPlugin INSTANCE = new PreferencesEditorPlugin();
-
+
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
@@ -40,10 +46,7 @@ public final class PreferencesEditorPlugin extends EMFPlugin
*/
public PreferencesEditorPlugin()
{
- super
- (new ResourceLocator []
- {
- });
+ super(new ResourceLocator[] {});
}
/**
@@ -58,7 +61,7 @@ public final class PreferencesEditorPlugin extends EMFPlugin
{
return plugin;
}
-
+
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
@@ -70,7 +73,7 @@ public final class PreferencesEditorPlugin extends EMFPlugin
{
return plugin;
}
-
+
/**
* The actual implementation of the Eclipse <b>Plugin</b>.
* <!-- begin-user-doc -->
@@ -88,7 +91,7 @@ public final class PreferencesEditorPlugin extends EMFPlugin
public Implementation()
{
super();
-
+
// Remember the static instance.
//
plugin = this;
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesModelWizard.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesModelWizard.java
index c734961afe..22022967f7 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesModelWizard.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesModelWizard.java
@@ -1,34 +1,28 @@
-/**
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
*/
package org.eclipse.emf.cdo.releng.preferences.presentation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.StringTokenizer;
+import org.eclipse.emf.cdo.releng.preferences.PreferencesFactory;
+import org.eclipse.emf.cdo.releng.preferences.PreferencesPackage;
+import org.eclipse.emf.cdo.releng.preferences.provider.PreferencesEditPlugin;
import org.eclipse.emf.common.CommonPlugin;
-
import org.eclipse.emf.common.util.URI;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
-
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
-
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
-import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.emf.ecore.xmi.XMLResource;
-
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.core.resources.IContainer;
@@ -37,53 +31,42 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
-
import org.eclipse.core.runtime.IProgressMonitor;
-
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
-
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
-
import org.eclipse.swt.SWT;
-
-import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.ModifyEvent;
-
+import org.eclipse.swt.events.ModifyListener;
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.Label;
-
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.ISetSelectionTarget;
-
-import org.eclipse.emf.cdo.releng.preferences.PreferencesFactory;
-import org.eclipse.emf.cdo.releng.preferences.PreferencesPackage;
-import org.eclipse.emf.cdo.releng.preferences.provider.PreferencesEditPlugin;
-
-
-import org.eclipse.core.runtime.Path;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.StringTokenizer;
/**
* This is a simple wizard for creating a new model file.
@@ -99,8 +82,9 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
* <!-- end-user-doc -->
* @generated
*/
- public static final List<String> FILE_EXTENSIONS =
- Collections.unmodifiableList(Arrays.asList(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditorFilenameExtensions").split("\\s*,\\s*")));
+ public static final List<String> FILE_EXTENSIONS = Collections
+ .unmodifiableList(Arrays.asList(PreferencesEditorPlugin.INSTANCE.getString(
+ "_UI_PreferencesEditorFilenameExtensions").split("\\s*,\\s*")));
/**
* A formatted list of supported file extensions, suitable for display.
@@ -108,8 +92,8 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
* <!-- end-user-doc -->
* @generated
*/
- public static final String FORMATTED_FILE_EXTENSIONS =
- PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+ public static final String FORMATTED_FILE_EXTENSIONS = PreferencesEditorPlugin.INSTANCE.getString(
+ "_UI_PreferencesEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
/**
* This caches an instance of the model package.
@@ -178,7 +162,8 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
this.workbench = workbench;
this.selection = selection;
setWindowTitle(PreferencesEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
- setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PreferencesEditorPlugin.INSTANCE.getImage("full/wizban/NewPreferences")));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PreferencesEditorPlugin.INSTANCE
+ .getImage("full/wizban/NewPreferences")));
}
/**
@@ -238,50 +223,49 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
// Do the work within an operation.
//
- WorkspaceModifyOperation operation =
- new WorkspaceModifyOperation()
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation()
+ {
+ @Override
+ protected void execute(IProgressMonitor progressMonitor)
{
- @Override
- protected void execute(IProgressMonitor progressMonitor)
+ try
{
- try
- {
- // Create a resource set
- //
- ResourceSet resourceSet = new ResourceSetImpl();
-
- // Get the URI of the model file.
- //
- URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
-
- // Create a resource for this file.
- //
- Resource resource = resourceSet.createResource(fileURI);
-
- // Add the initial model object to the contents.
- //
- EObject rootObject = createInitialModel();
- if (rootObject != null)
- {
- resource.getContents().add(rootObject);
- }
-
- // Save the contents of the resource to the file system.
- //
- Map<Object, Object> options = new HashMap<Object, Object>();
- options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
- resource.save(options);
- }
- catch (Exception exception)
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null)
{
- PreferencesEditorPlugin.INSTANCE.log(exception);
- }
- finally
- {
- progressMonitor.done();
+ resource.getContents().add(rootObject);
}
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
+ resource.save(options);
}
- };
+ catch (Exception exception)
+ {
+ PreferencesEditorPlugin.INSTANCE.log(exception);
+ }
+ finally
+ {
+ progressMonitor.done();
+ }
+ }
+ };
getContainer().run(false, false, operation);
@@ -293,27 +277,26 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
if (activePart instanceof ISetSelectionTarget)
{
final ISelection targetSelection = new StructuredSelection(modelFile);
- getShell().getDisplay().asyncExec
- (new Runnable()
- {
- public void run()
- {
- ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
- }
- });
+ getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
+ }
+ });
}
// Open an editor on the new file.
//
try
{
- page.openEditor
- (new FileEditorInput(modelFile),
- workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ page.openEditor(new FileEditorInput(modelFile),
+ workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
}
catch (PartInitException exception)
{
- MessageDialog.openError(workbenchWindow.getShell(), PreferencesEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
+ MessageDialog.openError(workbenchWindow.getShell(),
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
return false;
}
@@ -360,7 +343,7 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
if (extension == null || !FILE_EXTENSIONS.contains(extension))
{
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
- setErrorMessage(PreferencesEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
+ setErrorMessage(PreferencesEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
@@ -501,14 +484,13 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
* <!-- end-user-doc -->
* @generated
*/
- protected ModifyListener validator =
- new ModifyListener()
+ protected ModifyListener validator = new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
{
- public void modifyText(ModifyEvent e)
- {
- setPageComplete(validatePage());
- }
- };
+ setPageComplete(validatePage());
+ }
+ };
/**
* <!-- begin-user-doc -->
@@ -585,7 +567,7 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
{
return PreferencesEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
}
- catch(MissingResourceException mre)
+ catch (MissingResourceException mre)
{
PreferencesEditorPlugin.INSTANCE.log(mre);
}
@@ -602,7 +584,8 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
if (encodings == null)
{
encodings = new ArrayList<String>();
- for (StringTokenizer stringTokenizer = new StringTokenizer(PreferencesEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); )
+ for (StringTokenizer stringTokenizer = new StringTokenizer(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();)
{
encodings.add(stringTokenizer.nextToken());
}
@@ -617,15 +600,17 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
* <!-- end-user-doc -->
* @generated
*/
- @Override
+ @Override
public void addPages()
{
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new PreferencesModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesModelWizard_label"));
- newFileCreationPage.setDescription(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesModelWizard_description"));
- newFileCreationPage.setFileName(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
+ newFileCreationPage.setDescription(PreferencesEditorPlugin.INSTANCE
+ .getString("_UI_PreferencesModelWizard_description"));
+ newFileCreationPage.setFileName(PreferencesEditorPlugin.INSTANCE
+ .getString("_UI_PreferencesEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
@@ -655,7 +640,8 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
// Make up a unique new name here.
//
- String defaultModelBaseFilename = PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditorFilenameDefaultBase");
+ String defaultModelBaseFilename = PreferencesEditorPlugin.INSTANCE
+ .getString("_UI_PreferencesEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i)
@@ -668,7 +654,8 @@ public class PreferencesModelWizard extends Wizard implements INewWizard
}
initialObjectCreationPage = new PreferencesModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesModelWizard_label"));
- initialObjectCreationPage.setDescription(PreferencesEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
+ initialObjectCreationPage.setDescription(PreferencesEditorPlugin.INSTANCE
+ .getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}

Back to the top