summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-03-10 05:55:55 (EDT)
committerGabriel Pascual2014-03-10 05:55:55 (EDT)
commitb6f4f4fcdeed67f2dc1ac8107a15937116e4aa20 (patch)
tree426c07ccdf415dd7e8c4dbb41ee46bf9d126e7c1
parentfe4f416b6ec4de6a8314814efe40fb8d3ba56c88 (diff)
downloadorg.eclipse.papyrus-b6f4f4fcdeed67f2dc1ac8107a15937116e4aa20.zip
org.eclipse.papyrus-b6f4f4fcdeed67f2dc1ac8107a15937116e4aa20.tar.gz
org.eclipse.papyrus-b6f4f4fcdeed67f2dc1ac8107a15937116e4aa20.tar.bz2
429643: [CSS] Project shall have a property for associating project
style sheets https://bugs.eclipse.org/bugs/show_bug.cgi?id=429643 - Add label for property page - Externalize Strings of source code Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/messages.properties2
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/messages/Messages.java33
-rw-r--r--plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/property/StyleSheetsPropertyPage.java41
3 files changed, 68 insertions, 8 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/messages.properties b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/messages.properties
new file mode 100644
index 0000000..b4cac9d
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/messages.properties
@@ -0,0 +1,2 @@
+StyleSheetsPropertyPage.preference.page.label=Add CSS style sheets on project properties to apply them to all models.
+StyleSheetsPropertyPage.preference.page.title=CSS Style Sheet
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/messages/Messages.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/messages/Messages.java
new file mode 100644
index 0000000..81e9dfa
--- /dev/null
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/messages/Messages.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.css.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+
+ private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/property/StyleSheetsPropertyPage.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/property/StyleSheetsPropertyPage.java
index 408fc66..d7d8bf4 100644
--- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/property/StyleSheetsPropertyPage.java
+++ b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css/src/org/eclipse/papyrus/infra/gmfdiag/css/property/StyleSheetsPropertyPage.java
@@ -40,6 +40,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.papyrus.infra.emf.providers.EMFContentProvider;
import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
+import org.eclipse.papyrus.infra.gmfdiag.css.messages.Messages;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.EmbeddedStyleSheet;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.ModelStyleSheets;
import org.eclipse.papyrus.infra.gmfdiag.css.stylesheets.StyleSheet;
@@ -58,6 +59,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PropertyPage;
@@ -73,6 +75,12 @@ import org.eclipse.ui.dialogs.PropertyPage;
*/
public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
+ /** Text for preference page label. */
+ private static final String PREFERENCE_PAGE_LABEL = Messages.getString("StyleSheetsPropertyPage.preference.page.label"); //$NON-NLS-1$
+
+ /** Text for preference page title. */
+ private static final String PREFERENCE_PAGE_TITLE = Messages.getString("StyleSheetsPropertyPage.preference.page.title"); //$NON-NLS-1$
+
/** Preference resource of project to load and save. */
private Resource resource = null;
@@ -103,8 +111,6 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
}
-
-
/**
* Get Style sheets model file to manage preference.
*
@@ -122,7 +128,7 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
if(pageElement instanceof IProject) {
// Build path of preference file
ProjectScope pageProject = new ProjectScope((IProject)pageElement);
- IPath preferencePath = pageProject.getLocation().append("stylesheets.xmi");
+ IPath preferencePath = pageProject.getLocation().append("stylesheets.xmi"); //$NON-NLS-1$
// Check path is valid
if(preferencePath != null) {
@@ -164,11 +170,12 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
GridLayout containerLayout = new GridLayout(2, false);
container.setLayout(containerLayout);
- // Initialize data and providers fro page
+ // Initialize data and providers for page
initializeDataPage();
initializeProviders();
// Create different components
+ createLabelPage(container);
createStyleSheetsPageViewer(container);
createStyleSheetsPageButtons(container);
@@ -182,6 +189,24 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
/**
+ * Create label for page.
+ *
+ * @param parent
+ * Parent composite where compound will added
+ */
+ private void createLabelPage(Composite parent) {
+ Label labelPage = new Label(parent, SWT.NONE);
+
+ GridData layoutData = new GridData(SWT.FILL);
+ layoutData.horizontalSpan = 2;
+ labelPage.setLayoutData(layoutData);
+
+ labelPage.setText(PREFERENCE_PAGE_LABEL);
+
+ }
+
+
+ /**
* Initialize preference page.
*/
private void initializeDataPage() {
@@ -283,7 +308,7 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
//Add button
Button addButton = new Button(buttonsComposite, SWT.PUSH);
addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- addButton.setImage(Activator.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "/icons/Add_12x12.gif").createImage());
+ addButton.setImage(Activator.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "/icons/Add_12x12.gif").createImage()); //$NON-NLS-1$ //$NON-NLS-2$
addButton.addSelectionListener(new SelectionListener() {
/**
@@ -299,7 +324,7 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
selector.setLabelProvider(labelProvider);
// Use common component for add dialog and parameterize it
- MultipleValueSelectorDialog vDialog = new MultipleValueSelectorDialog(getShell(), selector, "CSS Style Sheet");
+ MultipleValueSelectorDialog vDialog = new MultipleValueSelectorDialog(getShell(), selector, PREFERENCE_PAGE_TITLE);
vDialog.setContextElement(modelStyleSheets);
vDialog.setLabelProvider(labelProvider);
vDialog.setFactory(new EcorePropertyEditorFactory(StylesheetsPackage.Literals.MODEL_STYLE_SHEETS__STYLESHEETS));
@@ -323,7 +348,7 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
removeButton = new Button(buttonsComposite, SWT.PUSH);
removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- removeButton.setImage(Activator.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "/icons/Delete_12x12.gif").createImage());
+ removeButton.setImage(Activator.imageDescriptorFromPlugin("org.eclipse.papyrus.infra.widgets", "/icons/Delete_12x12.gif").createImage()); //$NON-NLS-1$ //$NON-NLS-2$
removeButton.addSelectionListener(new SelectionListener() {
/**
@@ -448,7 +473,7 @@ public class StyleSheetsPropertyPage extends PropertyPage implements IWorkbenchP
*/
@Override
public String getText(Object element) {
- String text = "";
+ String text = ""; //$NON-NLS-1$
if(element instanceof StyleSheetReference) {
text = ((StyleSheetReference)element).getPath();