Author: dmaliarevich
Date: 2009-09-14 12:17:42 -0400 (Mon, 14 Sep 2009)
New Revision: 17548
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4671, VPE Preference Page was remade.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
import java.util.Properties;
@@ -79,7 +79,7 @@
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
import org.jboss.tools.jst.jsp.editor.IVisualEditorFactory;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
@@ -88,20 +88,13 @@
XModelTreeListener, ITextEditor, IGotoMarker, VpeTaglibManagerProvider,
IReusableEditor, ITextEditorExtension, ITextEditorExtension2,
ITextEditorExtension3, INavigationLocationProvider, IMultiPageEditor {
-
+
public static final String EDITOR_ID =
"org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
-
- //option loads preview tab
- private static final String PREVIEW_TAB="Preview"; //$NON-NLS-1$
- //visual tab
- private static final String VISUAL_SOURCE_TAB="Visual/Source"; //$NON-NLS-1$
-
- private static final String
VPE_VISUAL_EDITOR_IMPL_ID="org.jboss.tools.vpe.org.jboss.tools.vpe.editor.VpeEditorPartFactory";
//$NON-NLS-1$
- //source tab
- private static final String SOURCE_TAB="Source"; //$NON-NLS-1$
-
- private static final String
VISUAL_EDITOR_IMPL_EXTENSION_POINT_NAME="visulaEditorImplementations";
//$NON-NLS-1$
+ private static final String VPE_VISUAL_EDITOR_IMPL_ID =
"org.jboss.tools.vpe.org.jboss.tools.vpe.editor.VpeEditorPartFactory";
//$NON-NLS-1$
+
+ private static final String VISUAL_EDITOR_IMPL_EXTENSION_POINT_NAME =
"visulaEditorImplementations"; //$NON-NLS-1$
+
private IVisualEditor visualEditor;
private int visualSourceIndex;
@@ -109,19 +102,19 @@
private JSPTextEditor sourceEditor;
private int sourceIndex;
-
+
/** composite control for default web-browser */
- //private IVisualEditor previewWebBrowser;
-
+ // private IVisualEditor previewWebBrowser;
+
/** index of tab contain default web-browser */
private int previewIndex;
-// private boolean osWindows = true;
+ // private boolean osWindows = true;
protected XModelTreeListenerSWTSync syncListener = new XModelTreeListenerSWTSync(
this);
-// private int oldPage = -1;
+ // private int oldPage = -1;
private ConfigurableContentOutlinePage outlinePage = null;
@@ -135,7 +128,7 @@
static IVisualEditorFactory visualEditorFactory;
static {
- //Fix For JBIDE-2674
+ // Fix For JBIDE-2674
try {
IExtension visualEditorExtension = Platform.getExtensionRegistry()
.getExtension(JspEditorPlugin.PLUGIN_ID,
@@ -165,47 +158,23 @@
}
private void loadSelectedTab() {
- IFile file = getFile();
- try {
- String q = (file == null) ? null :
file.getPersistentProperty(persistentTabQualifiedName);
- if (q == null) {
- if (VISUAL_SOURCE_TAB.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 0;
- else if (SOURCE_TAB
- .equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 1;
- else if (PREVIEW_TAB
- .equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
- .getValue()))
- selectedPageIndex = 2;
- else
- selectedPageIndex = 0;
- } else {
- int qi = Integer.parseInt(q);
-
- if (qi >= 0 && qi < getTabFolder().getItemCount())
- selectedPageIndex = qi;
- }
-
- } catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ String defaultVpeTab = JspEditorPlugin.getDefault()
+ .getPreferenceStore().getString(
+ IVpePreferencesPage.DEFAULT_VPE_TAB);
+ if (IVpePreferencesPage.DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
selectedPageIndex = 0;
+ } else if (IVpePreferencesPage.DEFAULT_VPE_TAB_SOURCE_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
+ selectedPageIndex = 1;
+ } else if (IVpePreferencesPage.DEFAULT_VPE_TAB_PREVIEW_VALUE
+ .equalsIgnoreCase(defaultVpeTab)) {
+ selectedPageIndex = 2;
+ } else {
+ selectedPageIndex = 0;
}
}
- private void saveSelectedTab() {
- IFile file = getFile();
- if(file == null || !file.exists()) return;
- String q = "" + selectedPageIndex; //$NON-NLS-1$
- try {
- file.setPersistentProperty(persistentTabQualifiedName, q);
- } catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logWarning(e);
- }
- }
-
public void superPageChange(int newPageIndex) {
Control control = getControl(visualSourceIndex);
if (control != null) {
@@ -232,28 +201,27 @@
}
}
- protected void pageChange(int newPageIndex) {
+ public void pageChange(int newPageIndex) {
selectedPageIndex = newPageIndex;
- if(visualEditor!=null) {
- if (newPageIndex == visualSourceIndex) {
- if (visualEditor.getVisualEditor() == null) {
- visualEditor.createVisualEditor();
- }
- visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
-
- }else if (newPageIndex == sourceIndex)
- visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
- else if (newPageIndex == previewIndex) {
- if (visualEditor.getPreviewWebBrowser() == null) {
- visualEditor.createPreviewBrowser();
- }
- visualEditor.setVisualMode(IVisualEditor.PREVIEW_MODE);
+ if (visualEditor != null) {
+ if (newPageIndex == visualSourceIndex) {
+ if (visualEditor.getVisualEditor() == null) {
+ visualEditor.createVisualEditor();
}
- }
+ visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
+ } else if (newPageIndex == sourceIndex)
+ visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+ else if (newPageIndex == previewIndex) {
+ if (visualEditor.getPreviewWebBrowser() == null) {
+ visualEditor.createPreviewBrowser();
+ }
+ visualEditor.setVisualMode(IVisualEditor.PREVIEW_MODE);
+ }
+ }
superPageChange(newPageIndex);
-
+
}
-
+
public void setInput(IEditorInput input) {
super.setInput(XModelObjectEditorInput.checkInput(input));
if (getEditorInput() instanceof IModelObjectEditorInput) {
@@ -264,10 +232,9 @@
&& sourceEditor.getEditorInput() != getEditorInput()
&& sourceEditor.getEditorInput() != null) {
if (sourceEditor instanceof AbstractTextEditor) {
- ((AbstractTextEditor) sourceEditor)
- .setInput(getEditorInput());
+ ((AbstractTextEditor) sourceEditor).setInput(getEditorInput());
}
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualEditor.setInput(getEditorInput());
}
updateTitle();
@@ -277,7 +244,8 @@
private void updateFile() {
IFile file = getFile();
- if (file == null) return;
+ if (file == null)
+ return;
try {
file.refreshLocal(0, null);
} catch (CoreException e) {
@@ -299,11 +267,11 @@
*
*/
private ISelectionProvider selectionProvider = null;
-
- private JSPMultiPageEditorSite site;
+ private JSPMultiPageEditorSite site;
+
protected IEditorSite createSite(IEditorPart editor) {
- site = new JSPMultiPageEditorSite(this, editor) {
+ site = new JSPMultiPageEditorSite(this, editor) {
private ISelectionChangedListener postSelectionChangedListener = null;
private ISelectionChangedListener getPostSelectionChangedListener() {
@@ -333,7 +301,7 @@
}
public String getId() {
- return getSite().getId();
+ return getSite().getId();
}
/**
@@ -373,21 +341,21 @@
}
}
-
- public void dispose() {
- ISelectionProvider provider = getSelectionProvider();
+ public void dispose() {
+ ISelectionProvider provider = getSelectionProvider();
if (provider != null) {
provider
.removeSelectionChangedListener(getSelectionChangedListener());
- }
- if (provider instanceof IPostSelectionProvider &&
postSelectionChangedListener != null) {
- ((IPostSelectionProvider) provider)
- .removePostSelectionChangedListener(postSelectionChangedListener);
-
- }
- postSelectionChangedListener = null;
- super.dispose();
- }
+ }
+ if (provider instanceof IPostSelectionProvider
+ && postSelectionChangedListener != null) {
+ ((IPostSelectionProvider) provider)
+ .removePostSelectionChangedListener(postSelectionChangedListener);
+
+ }
+ postSelectionChangedListener = null;
+ super.dispose();
+ }
};
return site;
}
@@ -402,51 +370,51 @@
createPagesForVPE();
loadSelectedTab();
-// if (selectedPageIndex == sourceIndex) {
-// visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
-// // switchOutlineToJSPEditor();
-// }
-// if (selectedPageIndex == 2) {
-// setActivePage(0);
-// pageChange(0);
-// if (visualEditor != null)
-// visualEditor.maximizeSource();
-// selectedPageIndex=0;
-// } else if (selectedPageIndex == 1) {
-// setActivePage(0);
-// pageChange(0);
-// if (visualEditor != null)
-// visualEditor.maximizeVisual();
-// selectedPageIndex=0;
-// } else {
-// selectedPageIndex=0;
-// setActivePage(selectedPageIndex);
-// pageChange(selectedPageIndex);
-// }
+ // if (selectedPageIndex == sourceIndex) {
+ // visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+ // // switchOutlineToJSPEditor();
+ // }
+ // if (selectedPageIndex == 2) {
+ // setActivePage(0);
+ // pageChange(0);
+ // if (visualEditor != null)
+ // visualEditor.maximizeSource();
+ // selectedPageIndex=0;
+ // } else if (selectedPageIndex == 1) {
+ // setActivePage(0);
+ // pageChange(0);
+ // if (visualEditor != null)
+ // visualEditor.maximizeVisual();
+ // selectedPageIndex=0;
+ // } else {
+ // selectedPageIndex=0;
+ // setActivePage(selectedPageIndex);
+ // pageChange(selectedPageIndex);
+ // }
switch (selectedPageIndex) {
-
+
case 0: {
- //source/visual mode
+ // source/visual mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
break;
- }
+ }
case 1: {
- //source mode
+ // source mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
break;
- }
+ }
case 2: {
- //preview mode
- setActivePage(selectedPageIndex);
- pageChange(selectedPageIndex);
- break;
+ // preview mode
+ setActivePage(selectedPageIndex);
+ pageChange(selectedPageIndex);
+ break;
}
default: {
- //by default we sets source/visual mode
+ // by default we sets source/visual mode
setActivePage(0);
- pageChange(0);
+ pageChange(0);
break;
}
}
@@ -458,31 +426,32 @@
private void createPagesForVPE() {
sourceEditor = new JSPTextEditor(this);
- if(visualEditorFactory!=null) {
+ if (visualEditorFactory != null) {
visualEditor = visualEditorFactory.createVisualEditor(this,
sourceEditor, false);
}
try {
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualSourceIndex = addPage(visualEditor, getEditorInput());
- setPageText(visualSourceIndex,
JSPEditorMessages.JSPMultiPageEditor_TabLabel_VisualSource);
+ setPageText(
+ visualSourceIndex,
+ JSPEditorMessages.JSPMultiPageEditor_TabLabel_VisualSource);
setPartName(visualEditor.getTitle());
}
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
}
- /*try {
- visualIndex = addPage(visualEditor, getEditorInput());
- setPageText(visualIndex, JSPEditorMessages
- .getString(VISUAL_TAB_LABEL));
- setPartName(visualEditor.getTitle());
- } catch (PartInitException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }*/
+ /*
+ * try { visualIndex = addPage(visualEditor, getEditorInput());
+ * setPageText(visualIndex, JSPEditorMessages
+ * .getString(VISUAL_TAB_LABEL)); setPartName(visualEditor.getTitle());
+ * } catch (PartInitException e) {
+ * JspEditorPlugin.getPluginLog().logError(e); }
+ */
try {
- String sourceTabLabel = JSPEditorMessages.JSPMultiPageEditor_TabLabel_Source;
- if(visualEditor!=null) {
+ String sourceTabLabel = JSPEditorMessages.JSPMultiPageEditor_TabLabel_Source;
+ if (visualEditor != null) {
sourceIndex = addPage(visualEditor, getEditorInput());
setPageText(sourceIndex, sourceTabLabel);
setPartName(visualEditor.getTitle());
@@ -497,9 +466,10 @@
// Add tab contain default web-browser
try {
- if(visualEditor!=null) {
+ if (visualEditor != null) {
previewIndex = addPage(visualEditor, getEditorInput());
- setPageText(previewIndex, JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
+ setPageText(previewIndex,
+ JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
setPartName(visualEditor.getTitle());
}
} catch (PartInitException e) {
@@ -530,7 +500,7 @@
sourceEditor.addPropertyListener(pcl);
sourceEditor.doSaveAs();
sourceEditor.removePropertyListener(pcl);
- try {
+ try {
if (old.isModified())
new DiscardFileHandler().executeHandler(old, new Properties());
} catch (XModelException e) {
@@ -539,8 +509,8 @@
}
public void gotoMarker(final IMarker marker) {
- //setActivePage(IVisualEditor.VISUALSOURCE_MODE);
- //pageChange(IVisualEditor.VISUALSOURCE_MODE);
+ // setActivePage(IVisualEditor.VISUALSOURCE_MODE);
+ // pageChange(IVisualEditor.VISUALSOURCE_MODE);
setActivePage(IVisualEditor.SOURCE_MODE);
pageChange(IVisualEditor.SOURCE_MODE);
IGotoMarker adapter = (IGotoMarker) sourceEditor
@@ -575,7 +545,6 @@
}
public void dispose() {
- saveSelectedTab();
IEditorActionBarContributor contributor = getEditorSite()
.getActionBarContributor();
if (contributor != null
@@ -583,18 +552,18 @@
((MultiPageEditorActionBarContributor) contributor)
.setActivePage(null);
}
- if(visualEditor!=null) {
+ if (visualEditor != null) {
visualEditor.dispose();
}
- site.dispose();
+ site.dispose();
outlinePage = null;
XModelObject o = getModelObject();
if (o != null) {
o.getModel().removeModelTreeListener(syncListener);
}
- if (syncListener != null)
- syncListener.dispose();
- syncListener=null;
+ if (syncListener != null)
+ syncListener.dispose();
+ syncListener = null;
if (o != null && o.isModified() && o.isActive()) {
try {
((FolderImpl) o.getParent()).discardChildFile(o);
@@ -607,14 +576,14 @@
public Object getAdapter(Class adapter) {
if (IContentOutlinePage.class.equals(adapter)) {
-
- if (visualEditor != null) {
+
+ if (visualEditor != null) {
if (outlinePage == null)
outlinePage = (ConfigurableContentOutlinePage) visualEditor
.getAdapter(adapter);
return outlinePage;
}
-
+
} else if (IPropertySheetPage.class.equals(adapter)) {
if (sourceEditor != null)
return sourceEditor.getAdapter(adapter);
@@ -703,10 +672,10 @@
}
public VpeTaglibManager getTaglibManager() {
- if(sourceEditor!=null) {
- if(sourceEditor.getPageContext() instanceof VpeTaglibManager)
-
- return (VpeTaglibManager)sourceEditor.getPageContext();
+ if (sourceEditor != null) {
+ if (sourceEditor.getPageContext() instanceof VpeTaglibManager)
+
+ return (VpeTaglibManager) sourceEditor.getPageContext();
}
return null;
}
@@ -793,6 +762,19 @@
}
return null;
}
+
+ public void updatePartAccordingToPreferences() {
+ String tabIndex = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.DEFAULT_VPE_TAB);
+ try {
+ int ind = Integer.parseInt(tabIndex);
+ getTabFolder().setSelection(ind);
+ pageChange(ind);
+ } catch (NumberFormatException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+
}
class ResourceChangeListener implements IResourceChangeListener {
@@ -850,8 +832,8 @@
if (e.getJspEditor() != null
&& e.getJspEditor().getEditorInput() != e
.getEditorInput()) {
- ((AbstractTextEditor) e.getJspEditor())
- .setInput(e2);
+ ((AbstractTextEditor) e.getJspEditor())
+ .setInput(e2);
}
((XModelObjectEditorInput) ei).synchronize();
}
@@ -911,4 +893,5 @@
}
return null;
}
+
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -128,7 +128,7 @@
import org.jboss.tools.jst.jsp.outline.JSPContentOutlineConfiguration;
import org.jboss.tools.jst.jsp.outline.JSPPropertySheetConfiguration;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.text.xpl.IStructuredTextOccurrenceStructureProvider;
import
org.jboss.tools.jst.jsp.text.xpl.StructuredTextOccurrenceStructureProviderRegistry;
import org.jboss.tools.jst.jsp.ui.action.ExtendedFormatAction;
@@ -743,9 +743,8 @@
.getDropCommand(flavor,
JSPTagProposalFactory.getInstance());
- boolean promptAttributes = "yes" //$NON-NLS-1$
- .equals(VpePreference.ALWAYS_REQUEST_FOR_ATTRIBUTE
- .getValue());
+ boolean promptAttributes =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT);
dropCommand
.getDefaultModel()
.setPromptForTagAttributesRequired(promptAttributes);
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.preferences;
+
+public interface IVpePreferencesPage {
+
+ static final String SHOW_BORDER_FOR_UNKNOWN_TAGS = "Show Border for Unknown
Tags"; //$NON-NLS-1$
+ static final String SHOW_NON_VISUAL_TAGS = "Show non-visual tags";
//$NON-NLS-1$
+ static final String SHOW_SELECTION_TAG_BAR = "Show Selection Tag Bar";
//$NON-NLS-1$
+ static final String SHOW_RESOURCE_BUNDLES_USAGE_AS_EL = "Show Resource Bundles
Usage as EL Expressions"; //$NON-NLS-1$
+ static final String ASK_TAG_ATTRIBUTES_ON_TAG_INSERT = "Ask for tag attributes
during tag insert"; //$NON-NLS-1$
+ static final String ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR = "Ask for
confirmation when closing Selection Bar"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB = "Default VPE Tab"; //$NON-NLS-1$
+ static final String VISUAL_SOURCE_EDITORS_SPLITTING = "Visual/Source Editors
Splitting"; //$NON-NLS-1$
+ static final String VISUAL_SOURCE_EDITORS_WEIGHTS = "Size of Visual Editor Pane
0-100%"; //$NON-NLS-1$
+
+ static final String DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE = "0"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB_SOURCE_VALUE = "1"; //$NON-NLS-1$
+ static final String DEFAULT_VPE_TAB_PREVIEW_VALUE = "2"; //$NON-NLS-1$
+
+ static final String SPLITTING_VERT_TOP_SOURCE_VALUE = "1"; //$NON-NLS-1$
+ static final String SPLITTING_VERT_TOP_VISUAL_VALUE = "2"; //$NON-NLS-1$
+ static final String SPLITTING_HORIZ_LEFT_SOURCE_VALUE = "3"; //$NON-NLS-1$
+ static final String SPLITTING_HORIZ_LEFT_VISUAL_VALUE = "4"; //$NON-NLS-1$
+
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/IVpePreferencesPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
import org.eclipse.compare.Splitter;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
@@ -20,7 +17,6 @@
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.action.IAction;
@@ -78,8 +74,10 @@
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
import org.jboss.tools.jst.jsp.jspeditor.StorageRevisionEditorInputAdapter;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.IVpeHelpContextIds;
import org.jboss.tools.vpe.VpePlugin;
@@ -100,6 +98,7 @@
private IHandlerActivation sourceActivation,visualActivation, jumpingActivation;
private IHandler sourceMaxmin,visualMaxmin, jumping;
private Composite cmpEd;
+ private Composite cmpEdTl;
private CustomSashForm container;
protected EditorSettings editorSettings;
private StructuredTextEditor sourceEditor = null;
@@ -355,23 +354,6 @@
return sizes;
}
- protected void saveSplitterPosition(int[] weights) {
- IEditorInput input = getEditorInput();
- if (!(input instanceof IFileEditorInput))
- return;
- IFile file = ((IFileEditorInput) input).getFile();
- try {
- String s = String.valueOf(weights[0]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY1, s);
- s = String.valueOf(weights[1]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
- s = String.valueOf(weights[2]);
- file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
- } catch (CoreException e) {
- VpePlugin.getPluginLog().logError(e);
- }
- }
-
public void setVisualMode(int type) {
switch (type) {
case VISUALSOURCE_MODE:
@@ -503,7 +485,7 @@
/*
* Container composite for editor part
*/
- Composite cmpEdTl = new Composite(parent, SWT.NONE);
+ cmpEdTl = new Composite(parent, SWT.NONE);
GridLayout layoutEdTl = new GridLayout(2, false);
layoutEdTl.verticalSpacing = 0;
layoutEdTl.marginHeight = 0;
@@ -570,12 +552,7 @@
}
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING
- .getValue();
- if (CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT
- .equalsIgnoreCase(splitting)
- || CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP
- .equalsIgnoreCase(splitting)) {
+ if (CustomSashForm.isSourceEditorFirst()) {
sourceContent = new Composite(container, SWT.NONE);
visualContent = new Composite(container, SWT.NONE);
} else {
@@ -598,24 +575,11 @@
}
};
int[] weights = loadSplitterPosition();
- if (weights != null)
+ if (weights != null) {
container.setWeights(weights);
+ }
container.setSashBorders(new boolean[] { true, true, true });
-
- final PropertyChangeListener weightsChangeListener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- saveSplitterPosition(container.getWeights());
- }
- };
- container.addWeightsChangeListener(weightsChangeListener);
- container.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- container.removeWeightsChangeListener(weightsChangeListener);
- container.removeDisposeListener(this);
- }
-
- });
controlListener = new ControlListener() {
public void controlMoved(ControlEvent event) {}
public void controlResized(ControlEvent event) {
@@ -813,7 +777,7 @@
};
}
- private void fillContainer() {
+ public void fillContainer() {
/*
*
https://jira.jboss.org/jira/browse/JBIDE-4152
*
@@ -825,11 +789,13 @@
*/
CustomSashForm newContainer = new CustomSashForm(cmpEd, CustomSashForm
.getSplittingFromPreferences());
+ newContainer.setOrientation(CustomSashForm.getSplittingFromPreferences());
+
/*
* Reset editor's settings.
*/
if (editorSettings != null) {
- editorSettings.dispose();
+ editorSettings.clearOldSettings();
editorSettings.addSetting(new SashSetting(newContainer));
}
newContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -839,12 +805,7 @@
* Correct layout by selecting the order of components adding.
* All three editors should be added to the new container.
*/
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING
- .getValue();
- if (CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT
- .equalsIgnoreCase(splitting)
- || CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP
- .equalsIgnoreCase(splitting)) {
+ if (CustomSashForm.isSourceEditorFirst()) {
sourceContent.setParent(newContainer);
visualContent.setParent(newContainer);
} else {
@@ -860,7 +821,6 @@
if (null != container.getMaximizedControl()) {
newContainer.setMaximizedControl(container.getMaximizedControl());
}
-
/*
* Dispose the old container:
* it'll be excluded from parent composite's layout.
@@ -873,28 +833,43 @@
* Reset the container.
*/
container = newContainer;
- int[] weights = loadSplitterPosition();
- if (weights != null) {
- container.setWeights(weights);
+
+ /*
+ * Set up new sash weights
+ */
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
+ int[] weights = container.getWeights();
+ if (defaultWeight == 0) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxDown();
+ } else {
+ container.maxUp();
+ }
+ } else if (defaultWeight == 1000) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ container.maxUp();
+ } else {
+ container.maxDown();
+ }
+ } else {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ weights[0] = 1000 - defaultWeight;
+ weights[1] = defaultWeight;
+ } else {
+ weights[0] = defaultWeight;
+ weights[1] = 1000 - defaultWeight;
+ }
+ if ((weights != null) && !container.isDisposed()){
+ container.setWeights(weights);
+ }
}
+
container.setSashBorders(new boolean[] { true, true, true });
/*
* Reinit listeners on the new container.
*/
- final PropertyChangeListener weightsChangeListener = new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- saveSplitterPosition(container.getWeights());
- }
- };
- container.addWeightsChangeListener(weightsChangeListener);
- container.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- container.removeWeightsChangeListener(weightsChangeListener);
- container.removeDisposeListener(this);
- }
-
- });
controlListener = new ControlListener() {
public void controlMoved(ControlEvent event) {}
public void controlResized(ControlEvent event) {
@@ -903,9 +878,9 @@
};
/*
- * Layout parent composite.
+ * Layout the parent container for CustomSashForm, Selection Bar.
*/
- cmpEd.layout(true, true);
+ cmpEdTl.layout(true, true);
}
public void createVisualEditor() {
@@ -1142,8 +1117,9 @@
}
public VpeController getController() {
- if (visualEditor == null)
+ if (visualEditor == null) {
return null;
+ }
return visualEditor.getController();
}
@@ -1164,4 +1140,25 @@
if (container != null)
container.maxUp();
}
+
+ /*
+ * Updates current VpeEditorPart after
+ * OK/Apply button on "Visual Page Editor" preference page
+ * has been pressed.
+ */
+ public void updatePartAccordingToPreferences() {
+ /*
+ * When switching from Source view to Visual/Source
+ * controller could be null.
+ */
+ if (getController() != null) {
+ selectionBar.setVisible(selectionBar.getAlwaysVisibleOption());
+ fillContainer();
+
getController().getVisualBuilder().setShowInvisibleTags(JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS));
+ getController().getPageContext().getBundle().updateShowBundleUsageAsEL();
+ getController().visualRefresh();
+ }
+ }
+
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -38,6 +38,8 @@
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.vpe.VpeDebug;
@@ -185,8 +187,8 @@
// faceletFile = false;
// }
- this.showInvisibleTags = Constants.YES_STRING
- .equals(VpePreference.SHOW_INVISIBLE_TAGS.getValue());
+ this.showInvisibleTags = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -47,7 +47,8 @@
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.jboss.tools.vpe.VpePlugin;
@@ -64,7 +65,8 @@
private BundleEntry[] bundles = new BundleEntry[0];
private Map<String,UsedKey> usedKeys = new HashMap<String,UsedKey>();
- boolean isShowBundleUsageAsEL =
"yes".equals(VpePreference.SHOW_RESOURCE_BUNDLES.getValue()); //$NON-NLS-1$
+ boolean isShowBundleUsageAsEL =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
XModelTreeListener modelListener = new ML();
public void init(StructuredTextEditor editor){
@@ -461,7 +463,15 @@
}
}
-
+ public void updateShowBundleUsageAsEL() {
+ boolean b = JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
+ if(isShowBundleUsageAsEL != b) {
+ isShowBundleUsageAsEL = b;
+ refresh();
+ }
+ }
+
static class Expression {
public String prefix;
public String propertyName;
@@ -503,11 +513,7 @@
class ML implements XModelTreeListener {
public void nodeChanged(XModelTreeEvent event) {
- boolean b =
"yes".equals(VpePreference.SHOW_RESOURCE_BUNDLES.getValue()); //$NON-NLS-1$
- if(isShowBundleUsageAsEL != b) {
- isShowBundleUsageAsEL = b;
- refresh();
- }
+ updateShowBundleUsageAsEL();
}
public void structureChanged(XModelTreeEvent event) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -64,8 +64,8 @@
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.internal.part.StatusPart;
import org.eclipse.ui.part.EditorPart;
-import org.jboss.tools.common.model.XModelException;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPage;
@@ -78,7 +78,6 @@
import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.editor.util.FileUtil;
import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.resref.core.ReferenceWizard;
import org.jboss.tools.vpe.resref.core.VpeResourcesDialog;
@@ -133,20 +132,27 @@
private String doctype;
private static Map<String, String> layoutIcons;
- private static List<String> layoutNames;
+ private static Map<String, String> layoutNames;
+ private static List<String> layoutValues;
static {
layoutIcons = new HashMap<String, String>();
- layoutIcons.put(CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT,
ICON_ORIENTATION_SOURCE_LEFT);
- layoutIcons.put(CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP,
ICON_ORIENTATION_SOURCE_TOP);
- layoutIcons.put(CustomSashForm.LAYOUT_HORIZONTAL_VISUAL_LEFT,
ICON_ORIENTATION_SOURCE_RIGHT);
- layoutIcons.put(CustomSashForm.LAYOUT_VERTICAL_VISUAL_TOP,
ICON_ORIENTATION_SOURCE_BOTTOM);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE,
ICON_ORIENTATION_SOURCE_LEFT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE,
ICON_ORIENTATION_SOURCE_TOP);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE,
ICON_ORIENTATION_SOURCE_RIGHT);
+ layoutIcons.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE,
ICON_ORIENTATION_SOURCE_BOTTOM);
- layoutNames = new ArrayList<String>();
- layoutNames.add(CustomSashForm.LAYOUT_HORIZONTAL_SOURCE_LEFT);
- layoutNames.add(CustomSashForm.LAYOUT_VERTICAL_SOURCE_TOP);
- layoutNames.add(CustomSashForm.LAYOUT_HORIZONTAL_VISUAL_LEFT);
- layoutNames.add(CustomSashForm.LAYOUT_VERTICAL_VISUAL_TOP);
+ layoutNames = new HashMap<String, String>();
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE,
VpeUIMessages.SPLITTING_HORIZ_LEFT_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE,
VpeUIMessages.SPLITTING_VERT_TOP_SOURCE);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE,
VpeUIMessages.SPLITTING_HORIZ_LEFT_VISUAL);
+ layoutNames.put(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE,
VpeUIMessages.SPLITTING_VERT_TOP_VISUAL);
+ layoutValues= new ArrayList<String>();
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE);
+ layoutValues.add(IVpePreferencesPage.SPLITTING_VERT_TOP_VISUAL_VALUE);
+
}
/**
@@ -259,46 +265,64 @@
*
https://jira.jboss.org/jira/browse/JBIDE-4152
* Compute initial icon state and add it to the tool bar.
*/
- int currentOrientationIndex =
layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
+ int currentOrientationIndex = layoutValues.indexOf(JspEditorPlugin
+ .getDefault().getPreferenceStore().getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
int newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
}
- String newOrientation = layoutNames.get(newIndx);
+ String newOrientation = layoutValues.get(newIndx);
final ToolItem rotateEditorsItem = createToolItem(verBar, SWT.BUTTON1,
- layoutIcons.get(newOrientation),
- ICON_ORIENTATION_SOURCE_LEFT_DISABLED, newOrientation, true);
+ layoutIcons.get(newOrientation),
+ ICON_ORIENTATION_SOURCE_LEFT_DISABLED,
+ layoutNames.get(newOrientation), true);
+
rotateEditorsItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
- try {
- /*
- * Rotate editors orientation clockwise.
- * Store this new orientation to the preferences.
- */
- int currentOrientationIndex =
layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
- int newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
- }
- String newOrientation = layoutNames.get(newIndx);
- VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.setValue(newOrientation);
+ /*
+ * Rotate editors orientation clockwise. Store this new
+ * orientation to the preferences.
+ */
+ int currentOrientationIndex = layoutValues
+ .indexOf(JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
+ int newIndx = currentOrientationIndex + 1;
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
+ }
+ String newOrientation = layoutValues.get(newIndx);
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING,
+ newOrientation);
- /*
- * Compute next step orientation and display appropriate icon.
- */
- currentOrientationIndex =
layoutNames.indexOf(VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue());
- newIndx = currentOrientationIndex+1;
- if (newIndx == layoutNames.size()) {
- newIndx = newIndx % layoutNames.size();
- }
- newOrientation = layoutNames.get(newIndx);
- rotateEditorsItem.setImage(ImageDescriptor
- .createFromFile(MozillaEditor.class,
layoutIcons.get(newOrientation)).createImage());
- rotateEditorsItem.setToolTipText(newOrientation);
- } catch (XModelException e) {
- VpePlugin.getPluginLog().logError(e);
- }
+ /*
+ * Compute next step orientation and display appropriate icon.
+ */
+ currentOrientationIndex = layoutValues
+ .indexOf(JspEditorPlugin
+ .getDefault()
+ .getPreferenceStore()
+ .getString(
+ IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING));
+ newIndx = currentOrientationIndex + 1;
+ if (newIndx == layoutValues.size()) {
+ newIndx = newIndx % layoutValues.size();
+ }
+ newOrientation = layoutValues.get(newIndx);
+ rotateEditorsItem.setImage(ImageDescriptor.createFromFile(
+ MozillaEditor.class, layoutIcons.get(newOrientation))
+ .createImage());
+ rotateEditorsItem.setToolTipText(layoutNames.get(newOrientation));
+ /*
+ * Call <code>filContainer()</code> from VpeEditorPart
+ * to redraw CustomSashForm with new layout.
+ */
+ getController().getPageContext().getEditPart().fillContainer();
}
});
@@ -356,8 +380,8 @@
// create menu item
MenuItem menuItem = new MenuItem(dropDownMenu.getDropDownMenu(), SWT.PUSH);
// get default value of flag
- boolean showInvisibleTags = Constants.YES_STRING
- .equals(VpePreference.SHOW_INVISIBLE_TAGS.getValue());
+ boolean showInvisibleTags =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_NON_VISUAL_TAGS);
// set text
menuItem.setText(showInvisibleTags ? VpeUIMessages.HIDE_NON_VISUAL_TAGS
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Slider;
+
+public class SliderFieldEditor extends FieldEditor {
+
+ private static final String SLIDER_LABEL_DEFAULT_TEXT = "50% "; //$NON-NLS-1$
+ private static final String SLIDER_LABEL_MAX_SIZE_TEXT = "100% ";
//$NON-NLS-1$
+ private static final int MAX_SLIDER_VALUE = 1000;
+ private static final int MIN_SLIDER_VALUE = 0;
+ private static final int INCREMENT_SLIDER_VALUE = 10;
+ private static final int DEFAULT_SLIDER_VALUE = 500;
+
+ private Composite sliderComposite;
+ private Label sliderLabel;
+ private Slider slider;
+ private int value;
+
+ public SliderFieldEditor(String name, String labelText, Composite parent) {
+ super(name, labelText, parent);
+ }
+
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ if (numColumns > 1) {
+ Control control = getLabelControl();
+ int left = numColumns;
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ left = left - 1;
+ }
+ if (sliderComposite != null) {
+ ((GridData)sliderComposite.getLayoutData()).horizontalSpan = left;
+ }
+ } else {
+ Control control = getLabelControl();
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ }
+ if (sliderComposite != null) {
+ ((GridData)sliderComposite.getLayoutData()).horizontalSpan = 1;
+ }
+ }
+ }
+
+ @Override
+ protected void createControl(Composite parent) {
+ doFillIntoGrid(parent, 2);
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ int sliderSpan = 1;
+ if (numColumns > 1) {
+ sliderSpan = numColumns - 1;
+ }
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData();
+ gd.horizontalSpan = 1;
+ control.setLayoutData(gd);
+ control = getSliderComposite(parent);
+ gd = new GridData();
+ gd.horizontalSpan = sliderSpan;
+ gd.horizontalAlignment = GridData.FILL;
+ control.setLayoutData(gd);
+ control.setFont(parent.getFont());
+ }
+
+ @Override
+ protected void doLoad() {
+ updateSliderForValue(getPreferenceStore().getInt(getPreferenceName()));
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ updateSliderForValue(getPreferenceStore().getDefaultInt(getPreferenceName()));
+ }
+
+ @Override
+ protected void doStore() {
+ if (value < 0) {
+ getPreferenceStore().setToDefault(getPreferenceName());
+ return;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), value);
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ private Composite getSliderComposite(Composite parent) {
+ if (sliderComposite == null) {
+ /*
+ * Create composite control with label and slider in it.
+ */
+ sliderComposite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = HORIZONTAL_GAP;
+ sliderComposite.setLayout(gridLayout);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ sliderComposite.setLayoutData(gd);
+
+ /*
+ * Create slider label
+ */
+ sliderLabel = new Label(sliderComposite,SWT.NONE);
+ gd = new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1);
+ sliderLabel.setLayoutData(gd);
+ /*
+ * Compute label size
+ */
+ sliderLabel.setText(SLIDER_LABEL_MAX_SIZE_TEXT);
+ Point size = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ sliderLabel.setSize(size);
+ sliderLabel.setText(SLIDER_LABEL_DEFAULT_TEXT);
+
+ /*
+ * Create slider
+ */
+ slider = new Slider(sliderComposite, SWT.HORIZONTAL);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ slider.setLayoutData(gd);
+ slider.setMaximum(MAX_SLIDER_VALUE + slider.getThumb());
+ slider.setMinimum(MIN_SLIDER_VALUE);
+ slider.setIncrement(INCREMENT_SLIDER_VALUE);
+ slider.setSelection(DEFAULT_SLIDER_VALUE);
+
+ slider.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateSlider();
+ }
+ });
+ }
+
+ return sliderComposite;
+ }
+
+ private void updateSlider() {
+ int oldValue = value;
+ value = slider.getSelection();
+ if (oldValue != value) {
+ setPresentsDefaultValue(false);
+ String weightsString = "" + (value /10) + "%"; //$NON-NLS-1$
//$NON-NLS-2$
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+ fireValueChanged(VALUE, oldValue, value);
+ }
+ }
+
+ private void updateSliderForValue(int value) {
+ if (slider != null) {
+ String weightsString = "" + (value /10) + "%"; //$NON-NLS-1$
//$NON-NLS-2$
+ this.value = value;
+ slider.setSelection(value);
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+ }
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/SliderFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class VpeComboFieldEditor extends FieldEditor {
+
+ /**
+ * The <code>Combo</code> widget.
+ */
+ private Combo fCombo;
+
+ /**
+ * The value (not the name) of the currently selected item in the Combo widget.
+ */
+ private String fValue;
+
+ /**
+ * The names (labels) and underlying values to populate the combo widget. These should
be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ */
+ private String[][] fEntryNamesAndValues;
+
+ /**
+ * Create the combo box field editor.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param entryNamesAndValues the names (labels) and underlying values to populate the
combo widget. These should be
+ * arranged as: { {name1, value1}, {name2, value2}, ...}
+ * @param parent the parent composite
+ */
+ public VpeComboFieldEditor(String name, String labelText,
+ String[][] entryNamesAndValues, Composite parent) {
+ init(name, labelText);
+ Assert.isTrue(checkArray(entryNamesAndValues));
+ fEntryNamesAndValues = entryNamesAndValues;
+ createControl(parent);
+ }
+
+ /**
+ * Checks whether given <code>String[][]</code> is of "type"
+ * <code>String[][2]</code>.
+ *
+ * @return <code>true</code> if it is ok, and <code>false</code>
otherwise
+ */
+ private boolean checkArray(String[][] table) {
+ if (table == null) {
+ return false;
+ }
+ for (int i = 0; i < table.length; i++) {
+ String[] array = table[i];
+ if (array == null || array.length != 2) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
+ */
+ protected void adjustForNumColumns(int numColumns) {
+ if (numColumns > 1) {
+ Control control = getLabelControl();
+ int left = numColumns;
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ left = left - 1;
+ }
+ ((GridData)fCombo.getLayoutData()).horizontalSpan = left;
+ } else {
+ Control control = getLabelControl();
+ if (control != null) {
+ ((GridData)control.getLayoutData()).horizontalSpan = 1;
+ }
+ ((GridData)fCombo.getLayoutData()).horizontalSpan = 1;
+ }
+ }
+
+ @Override
+ protected void createControl(Composite parent) {
+ doFillIntoGrid(parent, 1);
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ /*
+ * Label
+ */
+ Control control = getLabelControl(parent);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ control.setLayoutData(gd);
+
+ /*
+ * Combo
+ */
+ control = getComboBoxControl(parent);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ control.setLayoutData(gd);
+ control.setFont(parent.getFont());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doLoad()
+ */
+ protected void doLoad() {
+ updateComboForValue(getPreferenceStore().getString(getPreferenceName()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+ */
+ protected void doLoadDefault() {
+ updateComboForValue(getPreferenceStore().getDefaultString(getPreferenceName()));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.FieldEditor#doStore()
+ */
+ protected void doStore() {
+ if (fValue == null) {
+ getPreferenceStore().setToDefault(getPreferenceName());
+ return;
+ }
+ getPreferenceStore().setValue(getPreferenceName(), fValue);
+ }
+
+ /*
+ * Lazily create and return the Combo control.
+ */
+ protected Combo getComboBoxControl(Composite parent) {
+ if (fCombo == null) {
+ fCombo = new Combo(parent, SWT.READ_ONLY);
+ fCombo.setFont(parent.getFont());
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ fCombo.add(fEntryNamesAndValues[i][0], i);
+ }
+
+ fCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ String oldValue = fValue;
+ String name = fCombo.getText();
+ fValue = getValueForName(name);
+ setPresentsDefaultValue(false);
+ fireValueChanged(VALUE, oldValue, fValue);
+ }
+ });
+ }
+ return fCombo;
+ }
+
+ /*
+ * Given the name (label) of an entry, return the corresponding value.
+ */
+ protected String getValueForName(String name) {
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ String[] entry = fEntryNamesAndValues[i];
+ if (name.equals(entry[0])) {
+ return entry[1];
+ }
+ }
+ return fEntryNamesAndValues[0][0];
+ }
+
+ /*
+ * Set the name in the combo widget to match the specified value.
+ */
+ protected void updateComboForValue(String value) {
+ fValue = value;
+ for (int i = 0; i < fEntryNamesAndValues.length; i++) {
+ if (value.equals(fEntryNamesAndValues[i][1])) {
+ fCombo.setText(fEntryNamesAndValues[i][0]);
+ return;
+ }
+ }
+ if (fEntryNamesAndValues.length > 0) {
+ fValue = fEntryNamesAndValues[0][1];
+ fCombo.setText(fEntryNamesAndValues[0][0]);
+ }
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeComboFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpeEditorPreferencesPage.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -10,24 +10,18 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.preferences;
-import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.jboss.tools.common.model.ui.preferences.TabbedPreferencesPage;
-import org.jboss.tools.common.model.ui.preferences.XMOBasedPreferencesPage;
-import org.jboss.tools.common.model.ui.util.ModelUtilities;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
public class VpeEditorPreferencesPage extends TabbedPreferencesPage implements
IWorkbenchPreferencePage {
public static final String ID = "org.jboss.tools.vpe.editor"; //$NON-NLS-1$
public VpeEditorPreferencesPage() {
- addPreferencePage(new GeneralPage());
+ addPreferencePage(new VpePreferencesPage());
addPreferencePage(new TemplatesPreferencePage());
}
@@ -41,13 +35,4 @@
prefsdlg.open();
}
- static class GeneralPage extends XMOBasedPreferencesPage {
- public GeneralPage() {
- super(ModelUtilities.getPreferenceModel().getByPath(VpePreference.VPE_EDITOR_PATH));
- }
-
- public String getTitle() {
- return VpeUIMessages.GENERAL;
- }
- }
}
\ No newline at end of file
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.editor.IVisualEditor;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+public class VpePreferencesPage extends FieldEditorPreferencePage implements
+ IWorkbenchPreferencePage, IVpePreferencesPage {
+
+ private static final String[][] DEFAULT_VPE_TAB_COMBO_BOX_VALUES = {
+ { VpeUIMessages.DEFAULT_VPE_TAB_VISUAL_SOURCE,
+ DEFAULT_VPE_TAB_VISUAL_SOURCE_VALUE },
+ { VpeUIMessages.DEFAULT_VPE_TAB_SOURCE,
+ DEFAULT_VPE_TAB_SOURCE_VALUE },
+ { VpeUIMessages.DEFAULT_VPE_TAB_PREVIEW,
+ DEFAULT_VPE_TAB_PREVIEW_VALUE } };
+ private static final String[][] SPLITTING_COMBO_BOX_VALUES = {
+ { VpeUIMessages.SPLITTING_VERT_TOP_SOURCE,
+ SPLITTING_VERT_TOP_SOURCE_VALUE },
+ { VpeUIMessages.SPLITTING_VERT_TOP_VISUAL,
+ SPLITTING_VERT_TOP_VISUAL_VALUE },
+ { VpeUIMessages.SPLITTING_HORIZ_LEFT_SOURCE,
+ SPLITTING_HORIZ_LEFT_SOURCE_VALUE },
+ { VpeUIMessages.SPLITTING_HORIZ_LEFT_VISUAL,
+ SPLITTING_HORIZ_LEFT_VISUAL_VALUE } };
+
+ private Composite pageContainer;
+ private Group visualAppearanceGroup;
+ private Group confirmationGroup;
+ private Group tabsGroup;
+
+ public VpePreferencesPage() {
+ super();
+ setPreferenceStore(getPreferenceStore());
+ }
+
+ public void init(IWorkbench workbench) {
+ /*
+ * Do nothing
+ */
+ }
+
+ public String getTitle() {
+ return VpeUIMessages.GENERAL_TAB_TITLE;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+
+ pageContainer = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ pageContainer.setLayout(layout);
+ pageContainer.setLayoutData(gd);
+
+ visualAppearanceGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ visualAppearanceGroup.setText(VpeUIMessages.VISUAL_APPEARANCE_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ visualAppearanceGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ visualAppearanceGroup.setLayoutData(gd);
+
+ confirmationGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ confirmationGroup.setText(VpeUIMessages.CONFIRMATION_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ layout.horizontalSpacing = 10;
+ layout.verticalSpacing = 10;
+ confirmationGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ confirmationGroup.setLayoutData(gd);
+
+ tabsGroup = new Group(pageContainer, SWT.SHADOW_ETCHED_IN);
+ tabsGroup.setText(VpeUIMessages.TABS_GROUP_TITLE);
+ layout = new GridLayout();
+ layout.marginHeight = 10;
+ layout.marginWidth = 10;
+ tabsGroup.setLayout(layout);
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1);
+ tabsGroup.setLayoutData(gd);
+
+ createFieldEditors();
+ initialize();
+ checkState();
+
+ return pageContainer;
+ }
+
+ @Override
+ protected Composite getFieldEditorParent() {
+ return pageContainer;
+ }
+
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(SHOW_BORDER_FOR_UNKNOWN_TAGS,
+ VpeUIMessages.SHOW_BORDER_FOR_UNKNOWN_TAGS, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_NON_VISUAL_TAGS,
+ VpeUIMessages.SHOW_NON_VISUAL_TAGS, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_SELECTION_TAG_BAR,
+ VpeUIMessages.SHOW_SELECTION_TAG_BAR, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(SHOW_RESOURCE_BUNDLES_USAGE_AS_EL,
+ VpeUIMessages.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL, visualAppearanceGroup));
+ addField(new BooleanFieldEditor(ASK_TAG_ATTRIBUTES_ON_TAG_INSERT,
+ VpeUIMessages.ASK_TAG_ATTRIBUTES_ON_TAG_INSERT, confirmationGroup));
+ addField(new BooleanFieldEditor(ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ VpeUIMessages.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR, confirmationGroup));
+ addField(new VpeComboFieldEditor(DEFAULT_VPE_TAB,
+ VpeUIMessages.DEFAULT_VPE_TAB, DEFAULT_VPE_TAB_COMBO_BOX_VALUES, tabsGroup));
+ addField(new VpeComboFieldEditor(VISUAL_SOURCE_EDITORS_SPLITTING,
+ VpeUIMessages.VISUAL_SOURCE_EDITORS_SPLITTING, SPLITTING_COMBO_BOX_VALUES,
tabsGroup));
+ addField(new SliderFieldEditor(VISUAL_SOURCE_EDITORS_WEIGHTS,
+ VpeUIMessages.VISUAL_SOURCE_EDITORS_WEIGHTS, tabsGroup));
+ }
+
+ @Override
+ public boolean performOk() {
+ super.performOk();
+ IEditorReference[] editors =
VpePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (IEditorReference editor : editors) {
+ IEditorPart editorPart = editor.getEditor(false);
+ if ((editorPart != null) && (editorPart instanceof JSPMultiPageEditor)) {
+ JSPMultiPageEditor mpe = (JSPMultiPageEditor)editorPart;
+ IVisualEditor visualEditor = (mpe).getVisualEditor();
+ if (visualEditor instanceof VpeEditorPart) {
+ VpeEditorPart vep = (VpeEditorPart) visualEditor;
+ /*
+ * Update visual editor
+ */
+ vep.updatePartAccordingToPreferences();
+ /*
+ * Change selected tab
+ */
+ mpe.updatePartAccordingToPreferences();
+ }
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public IPreferenceStore getPreferenceStore() {
+ return JspEditorPlugin.getDefault().getPreferenceStore();
+ }
+
+}
Property changes on:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/VpePreferencesPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAnyCreator.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -15,7 +15,8 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.expression.VpeExpression;
@@ -180,7 +181,8 @@
String styleString = getExprValue(pageContext, styleExpr, sourceNode);
- if
("yes".equalsIgnoreCase(VpePreference.SHOW_BORDER_FOR_UNKNOWN_TAGS.getValue()))
{ //$NON-NLS-1$
+ if (JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_BORDER_FOR_UNKNOWN_TAGS)) {
styleString = "border: 1px solid green;" +styleString; //$NON-NLS-1$
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -29,7 +29,8 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.vpe.messages.VpeUIMessages;
/**
@@ -45,10 +46,6 @@
public class CustomSashForm extends SashForm {
public static final String copyright = "(c) Copyright IBM Corporation 2002.";
//$NON-NLS-1$
- public static final String LAYOUT_VERTICAL_SOURCE_TOP = "Vertical Source on
top"; //$NON-NLS-1$
- public static final String LAYOUT_VERTICAL_VISUAL_TOP = "Vertical Visual on
top"; //$NON-NLS-1$
- public static final String LAYOUT_HORIZONTAL_SOURCE_LEFT = "Horizontal Source to
the left"; //$NON-NLS-1$
- public static final String LAYOUT_HORIZONTAL_VISUAL_LEFT = "Horizontal Visual to
the left"; //$NON-NLS-1$
/**
* Custom style bits. They set whether max to one side of the other
* is not permitted. For example, if NO_MAX_UP, then there will be only
@@ -81,17 +78,11 @@
/*
* Init the sash weight with the default value.
*/
- String defaultWeightString =
VpePreference.SOURCE_VISUAL_EDITORS_WEIGHTS.getValue();
- try {
- int defaultWeight = Integer.parseInt(defaultWeightString);
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
if (defaultWeight > 0) {
weight = defaultWeight;
}
- } catch (NumberFormatException e) {
- /*
- * Do nothing
- */
- }
}
};
@@ -382,7 +373,8 @@
if (currentSashInfo.cursorOver != i) {
currentSashInfo.cursorOver = i;
currentSashInfo.sash.redraw();
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
switch (locs[ARROW_TYPE_INDEX]) {
case UP_ARROW:
case DOWN_ARROW:
@@ -393,20 +385,20 @@
*
https://jira.jboss.org/jira/browse/JBIDE-4270
* Tooltip text should correspond panes position.
*/
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_VERTICAL_SOURCE_TOP.equalsIgnoreCase(splitting)) {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
- } else {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
- }
+ if
(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE.equalsIgnoreCase(splitting)
+ ||
IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE.equalsIgnoreCase(splitting)) {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
+ } else {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
+ }
break;
case DOWN_MAX_ARROW:
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_VERTICAL_SOURCE_TOP.equalsIgnoreCase(splitting)) {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
- } else {
- currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
- }
+ if
(IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE.equalsIgnoreCase(splitting)
+ ||
IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE.equalsIgnoreCase(splitting)) {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_SOURCE_PANE);
+ } else {
+ currentSashInfo.sash.setToolTipText(VpeUIMessages.MAX_VISUAL_PANE);
+ }
break;
}
}
@@ -1098,16 +1090,7 @@
gc.drawLine(x+3, y+1, x+3, y+6);
gc.drawLine(x+2, y+1, x+2, y+7);
}
-
- public int getSavedWeight() {
- if (currentSashInfo!=null)
- return currentSashInfo.weight;
- else
- return -1;
- }
-
-
protected Sash getSash() {
Control[] kids = getChildren();
for (int i = 0; i < kids.length; i++) {
@@ -1117,13 +1100,6 @@
return null;
}
- public void setCurrentSavedWeight(int weight) {
- if (weight>=0 && currentSashInfo!=null) {
- recomputeSashInfo(false);
- currentSashInfo.weight=weight;
- }
- }
-
/**
* Adds a custom sashform listener. This listener will be removed when
* this control is disposed.
@@ -1178,20 +1154,36 @@
}
public void changeOrientation() {
- int prefsOrientation = getSplittingFromPreferences();
- if (getOrientation() != prefsOrientation) {
- setOrientation(prefsOrientation);
- }
+ int prefsOrientation = getSplittingFromPreferences();
+ if (getOrientation() != prefsOrientation) {
+ setOrientation(prefsOrientation);
+ }
}
public static int getSplittingFromPreferences() {
- String splitting = VpePreference.VISUAL_SOURCE_EDITORS_SPLITTING.getValue();
- if (LAYOUT_HORIZONTAL_SOURCE_LEFT.equalsIgnoreCase(splitting)
- || LAYOUT_HORIZONTAL_VISUAL_LEFT.equalsIgnoreCase(splitting)) {
- return SWT.HORIZONTAL;
- } else {
- return SWT.VERTICAL;
- }
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_HORIZ_LEFT_VISUAL_VALUE
+ .equalsIgnoreCase(splitting)) {
+ return SWT.HORIZONTAL;
+ } else {
+ return SWT.VERTICAL;
+ }
}
+ public static boolean isSourceEditorFirst() {
+ boolean sourceEditorFirst = false;
+ String splitting = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getString(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_SPLITTING);
+ if (IVpePreferencesPage.SPLITTING_HORIZ_LEFT_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)
+ || IVpePreferencesPage.SPLITTING_VERT_TOP_SOURCE_VALUE
+ .equalsIgnoreCase(splitting)) {
+ sourceEditorFirst = true;
+ }
+ return sourceEditorFirst;
+ }
+
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -67,6 +67,10 @@
editor=null;
}
+ public void clearOldSettings() {
+ settings.clear();
+ }
+
public void setInput(FileEditorInput input) {
file = input.getFile();
for (int i = 0; i < settings.size(); i++) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -9,8 +9,8 @@
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
@@ -30,128 +30,47 @@
private QualifiedName name;
private CustomSashForm sash;
- private ControlListener listener=null;
private Control listenedControl=null;
private int weights[];
- /**
- * Save both the current weights, and the (potential) save
- * weights. The first value is the size of the
- * current weights
- *
- * @since 1.1.0
- */
- protected void updateWeights() {
- weights = sash.getWeights();
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < weights.length; i++) {
- if (i>0)
- sb.append(EditorSettings.SEPERATOR);
- sb.append(weights[i]);
- }
- sb.append(EditorSettings.SEPERATOR);
- sb.append(-1); // seperate between current weights, and saved weights
- sb.append(EditorSettings.SEPERATOR);
- sb.append(sash.getSavedWeight());
- try {
- //fix for JBIDE-3805
- if(resource.exists()) {
- resource.setPersistentProperty(name,sb.toString());
- }
- } catch (CoreException e) {
- VpePlugin.getPluginLog().logError(e);
- }
- }
-
public SashSetting(CustomSashForm s) {
sash = s;
}
- protected void addListener() {
- if (listener==null && !sash.isDisposed()) {
- listener = new ControlListener() {
- public void controlResized(ControlEvent e) {
- updateWeights();
- }
- public void controlMoved(ControlEvent e) {
- updateWeights();
- }
- };
- listenedControl = sash.getChildren()[0];
- listenedControl.addControlListener(listener);
- }
- }
-
- protected void removeListener() {
- if (listenedControl!=null && !listenedControl.isDisposed()) {
- listenedControl.removeControlListener(listener);
- listener=null;
- listenedControl=null;
- }
- }
-
public void apply() {
- try {
- String val = resource.getPersistentProperty(name);
- if (val!=null) {
- StringTokenizer st = new StringTokenizer(val,EditorSettings.SEPERATOR);
- weights = new int[st.countTokens()];
- int index = 0;
- while(st.hasMoreTokens()) {
- String s = st.nextToken();
- weights[index++]=Integer.parseInt(s);
+ /*
+ * Set weights from the preference page
+ */
+ int defaultWeight = JspEditorPlugin.getDefault().getPreferenceStore()
+ .getInt(IVpePreferencesPage.VISUAL_SOURCE_EDITORS_WEIGHTS);
+ int[] weights = sash.getWeights();
+ if (weights.length > 2) {
+ if (defaultWeight == 0) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ sash.maxDown();
+ } else {
+ sash.maxUp();
}
- for (index = 0; index < weights.length; index++) {
- if (weights[index]<0)
- break;
+ } else if (defaultWeight == 1000) {
+ if (CustomSashForm.isSourceEditorFirst()) {
+ sash.maxUp();
+ } else {
+ sash.maxDown();
}
- int saved = -1;
- if (index<weights.length) {
- int w[] = new int[index];
- for (int i = 0; i < w.length; i++) {
- w[i] = weights[i];
- }
- saved = weights[index+1];
- weights=w;
- }
- sash.setWeights(weights);
- if (saved>=0)
- sash.setCurrentSavedWeight(saved);
} else {
- /*
- * Set weights from the preference page
- */
- String stringValue = VpePreference.SOURCE_VISUAL_EDITORS_WEIGHTS.getValue();
- try {
- int intValue = Integer.parseInt(stringValue);
- int[] weights = sash.getWeights();
- if (weights.length > 2) {
- if (intValue == 0) {
- sash.maxDown();
- } else if (intValue == 1000) {
- sash.maxUp();
- } else {
- weights[0] = intValue;
- weights[1] = 1000 - intValue;
- sash.setWeights(weights);
- }
- }
- } catch (NumberFormatException e) {
- // Do nothing
+ if (CustomSashForm.isSourceEditorFirst()) {
+ weights[0] = 1000 - defaultWeight;
+ weights[1] = defaultWeight;
+ } else {
+ weights[0] = defaultWeight;
+ weights[1] = 1000 - defaultWeight;
}
+ sash.setWeights(weights);
}
- } catch (CoreException e1) {
- VpePlugin.getPluginLog().logError(e1);
}
- addListener();
}
-
- public void dispose() {
- removeListener();
- }
-
public void setQualifier(String q) {
name = new QualifiedName(q,id);
}
@@ -163,4 +82,8 @@
public void setResource(IResource r) {
resource = r;
}
+
+ public void dispose() {
+
+ }
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -113,4 +113,25 @@
public static String INCLUDED_CSS_FILES_ABOUT;
public static String INCLUDED_TAG_LIBS_ABOUT;
public static String SUBSTITUTED_EL_EXPRESSIONS_ABOUT;
+
+ public static String GENERAL_TAB_TITLE;
+ public static String VPE_PREFERENCES_PAGE_DESCRIPTION;
+ public static String SHOW_BORDER_FOR_UNKNOWN_TAGS;
+ public static String SHOW_SELECTION_TAG_BAR;
+ public static String SHOW_RESOURCE_BUNDLES_USAGE_AS_EL;
+ public static String ASK_TAG_ATTRIBUTES_ON_TAG_INSERT;
+ public static String ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR;
+ public static String DEFAULT_VPE_TAB;
+ public static String VISUAL_SOURCE_EDITORS_SPLITTING;
+ public static String VISUAL_SOURCE_EDITORS_WEIGHTS;
+ public static String DEFAULT_VPE_TAB_VISUAL_SOURCE;
+ public static String DEFAULT_VPE_TAB_SOURCE;
+ public static String DEFAULT_VPE_TAB_PREVIEW;
+ public static String SPLITTING_VERT_TOP_SOURCE;
+ public static String SPLITTING_VERT_TOP_VISUAL;
+ public static String SPLITTING_HORIZ_LEFT_SOURCE;
+ public static String SPLITTING_HORIZ_LEFT_VISUAL;
+ public static String VISUAL_APPEARANCE_GROUP_TITLE;
+ public static String CONFIRMATION_GROUP_TITLE;
+ public static String TABS_GROUP_TITLE;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2009-09-14
16:17:42 UTC (rev 17548)
@@ -6,8 +6,8 @@
PREFERENCES=Preferences
REFRESH=Refresh
PAGE_DESIGN_OPTIONS=Page Design Options
-HIDE_SELECTION_BAR=Hide Selection Bar
-SHOW_SELECTION_BAR=Show Selection Bar
+HIDE_SELECTION_BAR=Hide selection bar
+SHOW_SELECTION_BAR=Show selection bar
MOZILLA_LOADING_ERROR=Could not open the Visual Page Editor: {0}
MOZILLA_LOADING_ERROR_LINK_TEXT=See JBoss Tools Visual Editor FAQ
# START NON-TRANSLATABLE
@@ -91,4 +91,28 @@
ACTUAL_RUN_TIME_FOLDERS_ABOUT=These options will be used by Visual Page Editor for
replacing absolute and relative path values when generating a preview
INCLUDED_CSS_FILES_ABOUT=These CSS files will be linked by Visual Page Editor when
generating a preview
INCLUDED_TAG_LIBS_ABOUT=These Taglibs will be used by Visual Page Editor for getting
appropriate template for generating a preview, if this Taglibs doesn't included on
page
-SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page
Editor when generating a preview
\ No newline at end of file
+SUBSTITUTED_EL_EXPRESSIONS_ABOUT=These EL expressions will be substituted by Visual Page
Editor when generating a preview
+
+# Visual Page Editor Preference Page
+GENERAL_TAB_TITLE=General
+VPE_PREFERENCES_PAGE_DESCRIPTION=Visual Page Editor settings
+SHOW_BORDER_FOR_UNKNOWN_TAGS=Show border for unknown tags
+SHOW_SELECTION_TAG_BAR=Show selection tag bar
+SHOW_RESOURCE_BUNDLES_USAGE_AS_EL=Show resource bundles usage as EL expressions
+ASK_TAG_ATTRIBUTES_ON_TAG_INSERT=Ask for tag attributes during tag insert
+ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR=Ask for confirmation when closing Selection
Bar
+DEFAULT_VPE_TAB=Select the default active editor's tab for files that haven't
been previously opened in the VPE
+VISUAL_SOURCE_EDITORS_SPLITTING=Visual/Source editors splitting
+VISUAL_SOURCE_EDITORS_WEIGHTS=Size of the Visual Editor pane (0-100%)
+VISUAL_APPEARANCE_GROUP_TITLE=Visual appearance
+CONFIRMATION_GROUP_TITLE=Confirmation and details
+TABS_GROUP_TITLE=Tabs
+
+# Visual Page Editor Preference Page List Items
+DEFAULT_VPE_TAB_VISUAL_SOURCE=Visual/Source
+DEFAULT_VPE_TAB_SOURCE=Source
+DEFAULT_VPE_TAB_PREVIEW=Preview
+SPLITTING_VERT_TOP_SOURCE=Vertical splitting with Source Editor on the top
+SPLITTING_VERT_TOP_VISUAL=Vertical splitting with Visual Editor on the top
+SPLITTING_HORIZ_LEFT_SOURCE=Horizontal splitting with Source Editor to the left
+SPLITTING_HORIZ_LEFT_VISUAL=Horizontal splitting with Visual Editor to the left
\ No newline at end of file
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-09-14
15:06:24 UTC (rev 17547)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-09-14
16:17:42 UTC (rev 17548)
@@ -50,6 +50,8 @@
import org.jboss.tools.common.model.ui.attribute.adapter.AdapterFactory;
import org.jboss.tools.common.model.ui.attribute.adapter.IModelPropertyEditorAdapter;
import org.jboss.tools.common.model.ui.util.ModelUtilities;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
@@ -126,7 +128,7 @@
final Listener closeListener = new Listener() {
public void handleEvent(Event event) {
- if (!getHideWithoutPromptOption()) {
+ if (askConfirmationOnClosingSelectionBar()) {
MessageDialogWithToggle dialog = MessageDialogWithToggle
.openOkCancelConfirm(
PlatformUI.getWorkbench()
@@ -134,14 +136,13 @@
.getShell(),
VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TITLE,
VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_MESSAGE,
- VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE,
- false, null, null);
+// VpeUIMessages.CONFIRM_SELECTION_BAR_DIALOG_TOGGLE_MESSAGE,
+ VpeUIMessages.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmationOnClosingSelectionBar(), null, null);
if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
return;
}
- if (dialog.getToggleState()) {
- setHideWithoutPromptOption(true);
- }
+ setAskConfirmationOnClosingSelectionBar(dialog.getToggleState());
}
setAlwaysVisibleOption(false);
@@ -203,24 +204,19 @@
}
public boolean getAlwaysVisibleOption() {
- return VpePreference.SHOW_SELECTION_TAG_BAR.getValue().equals(PREFERENCE_YES);
+ return JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.SHOW_SELECTION_TAG_BAR);
}
- public void setHideWithoutPromptOption(boolean hideWithoutPrompt) {
- final String optionValue;
- if (hideWithoutPrompt) {
- optionValue = PREFERENCE_YES;
- } else {
- optionValue = PREFERENCE_NO;
- }
-
- setPersistentOption(VpePreference.ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT,
- optionValue);
+ public void setAskConfirmationOnClosingSelectionBar(boolean askConfirmation) {
+ JspEditorPlugin.getDefault().getPreferenceStore().setValue(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR,
+ askConfirmation);
}
- public boolean getHideWithoutPromptOption() {
- return VpePreference.ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT
- .getValue().equals(PREFERENCE_YES);
+ public boolean askConfirmationOnClosingSelectionBar() {
+ return JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ IVpePreferencesPage.ASK_CONFIRMATION_ON_CLOSING_SELECTION_BAR);
}
/**