diff options
author | Tom Schindl | 2013-02-05 14:01:30 +0000 |
---|---|---|
committer | Tom Schindl | 2013-02-05 14:01:30 +0000 |
commit | 1538f242d6dc6d1df9572910796495f011a8b7f5 (patch) | |
tree | 4a2d6ee9a9b7419c37313a1213feaef027ba358f | |
parent | 4e3c17819132e68a6013ba703af6ae7fa80afe16 (diff) | |
parent | 00200542784841160ff52a98d3fac0b863ccac6f (diff) | |
download | org.eclipse.e4.tools-1538f242d6dc6d1df9572910796495f011a8b7f5.tar.gz org.eclipse.e4.tools-1538f242d6dc6d1df9572910796495f011a8b7f5.tar.xz org.eclipse.e4.tools-1538f242d6dc6d1df9572910796495f011a8b7f5.zip |
Merge branch 'master' of ssh://tschindl@git.eclipse.org/gitroot/e4/org.eclipse.e4.tools.gitI20130207-2200I20130206-1900I20130206-1000I20130205-2200
2 files changed, 24 insertions, 16 deletions
diff --git a/bundles/org.eclipse.e4.tools.css.editor.ui/src/org/eclipse/e4/ui/preferences/CSSEditorPreferences.java b/bundles/org.eclipse.e4.tools.css.editor.ui/src/org/eclipse/e4/ui/preferences/CSSEditorPreferences.java index 92f6ee94..7dee5923 100644 --- a/bundles/org.eclipse.e4.tools.css.editor.ui/src/org/eclipse/e4/ui/preferences/CSSEditorPreferences.java +++ b/bundles/org.eclipse.e4.tools.css.editor.ui/src/org/eclipse/e4/ui/preferences/CSSEditorPreferences.java @@ -5,6 +5,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.net.URL; import java.util.ArrayList; import java.util.List; @@ -18,6 +19,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine; import org.eclipse.e4.ui.css.swt.theme.ITheme; @@ -27,6 +29,7 @@ import org.eclipse.e4.ui.model.application.ui.basic.MWindow; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.e4.ui.workbench.modeling.EPartService; import org.eclipse.jface.text.IDocument; +import org.eclipse.osgi.service.datalocation.Location; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; @@ -110,22 +113,22 @@ public class CSSEditorPreferences extends PreferencePageEnhancer { if (cssEditor.isDirty()) { // make a copy of file IDocumentProvider docProvider = cssEditor.getDocumentProvider(); - IEditorInput editorInput = cssEditor.getEditorInput(); IDocument doc = docProvider.getDocument(editorInput); String more = doc.get(); //check for .e4css folder - String e4CSSPath = System.getProperty("user.home") + System.getProperty("file.separator") + ".e4css"; - File e4CSS = new File(e4CSSPath); - if (!e4CSS.exists()) { - File userHome = e4CSS.getParentFile( ); - if ( userHome.exists() && userHome.canWrite() ) - { - e4CSS.mkdir(); + Location configLocation = Platform.getConfigurationLocation(); + String e4CSSPath = null; + try { + URL locationURL = new URL(configLocation.getDataArea(ThemeEngine.THEME_PLUGIN_ID).toString()); + File locationFile = new File(locationURL.getFile()); + e4CSSPath = locationFile.getPath(); + if (!locationFile.exists()) { + locationFile.mkdirs(); } - } + } catch (IOException e1) { + } IPath path = new Path(e4CSSPath + System.getProperty("file.separator") + editorInput.getName()); //$NON-NLS-1$ - byte[] bytes = more.getBytes(); FileOutputStream outputStream = null; try { @@ -140,11 +143,10 @@ public class CSSEditorPreferences extends PreferencePageEnhancer { } catch (IOException e) { } } - if (engine instanceof ThemeEngine) { ArrayList<String> styleSheets = new ArrayList<String>(); try { - URL styleSheetURL = FileLocator.toFileURL(path.toFile().toURI().toURL()); + URL styleSheetURL = path.toFile().toURI().toURL(); styleSheets.add(styleSheetURL.toString()); ((ThemeEngine) engine).themeModified(selection, styleSheets ); } catch (MalformedURLException e) { @@ -171,21 +173,26 @@ public class CSSEditorPreferences extends PreferencePageEnhancer { .getProject(".e4css"); //$NON-NLS-1$ URL styleSheetURL = null; + File modFile = null; if (engine instanceof ThemeEngine) { List<String> ss = ((ThemeEngine) engine).getStylesheets(selection); List<String> mod = ((ThemeEngine) engine).getModifiedStylesheets(selection); if (mod.size() > 0) { ss = mod; } + if (ss.size() > 0) { // For now just get the first element String path = ss.get(0); try { styleSheetURL = FileLocator.toFileURL(new URL(path)); + modFile = new File (styleSheetURL.toURI()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); + } catch (URISyntaxException e) { + e.printStackTrace(); } } } @@ -201,8 +208,7 @@ public class CSSEditorPreferences extends PreferencePageEnhancer { } newProject.setHidden(true); // currentTheme. - IPath location = new Path(styleSheetURL.getPath()); - // IPath location = new Path(styleSheetURL.getPath()); + IPath location = new Path(modFile.getPath()); file = newProject.getFile(location.lastSegment()); file.delete(true, null); if (!file.exists()) diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java index 45b4aafe..40f22b5a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java @@ -81,6 +81,7 @@ public class PartStackEditor extends AbstractComponentEditor { @Inject @Optional private IProject project; + private TableViewer viewer; @Inject public PartStackEditor() { @@ -160,7 +161,8 @@ public class PartStackEditor extends AbstractComponentEditor { composite.layout(true, true); } } - + IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN); + viewer.setInput(prop.observeDetail(getMaster())); getMaster().setValue(object); return composite; } @@ -234,7 +236,7 @@ public class PartStackEditor extends AbstractComponentEditor { new Label(parent, SWT.NONE); - final TableViewer viewer = new TableViewer(parent); + viewer = new TableViewer(parent); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages)); GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1); |