JBoss Tools SVN: r17675 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: toolbar/format/handler and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-21 07:42:44 -0400 (Mon, 21 Sep 2009)
New Revision: 17675
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
Log:
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java 2009-09-21 11:41:56 UTC (rev 17674)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction.java 2009-09-21 11:42:44 UTC (rev 17675)
@@ -19,6 +19,7 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.web.tld.TLDToPaletteHelper;
import org.jboss.tools.jst.web.tld.URIConstants;
import org.jboss.tools.vpe.editor.context.VpePageContext;
@@ -145,7 +146,7 @@
*/
// if(((Node)region).getNodeType() == Node.ELEMENT_NODE)
p.put("selectionProvider", selProvider); //$NON-NLS-1$
- PaletteInsertHelper.insertIntoEditor(sourceEditor.getTextViewer(), p);
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(sourceEditor.getTextViewer(), p);
}
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java 2009-09-21 11:41:56 UTC (rev 17674)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/action/InsertAction2.java 2009-09-21 11:42:44 UTC (rev 17675)
@@ -19,6 +19,7 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.web.tld.TLDToPaletteHelper;
import org.jboss.tools.jst.web.tld.URIConstants;
import org.jboss.tools.vpe.editor.menu.InsertType;
@@ -215,7 +216,7 @@
// if(((Node)region).getNodeType() == Node.ELEMENT_NODE)
p.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER,
selectionProvider);
- PaletteInsertHelper.insertIntoEditor(sourceEditor.getTextViewer(), p);
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(sourceEditor.getTextViewer(), p);
}
/**
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java 2009-09-21 11:41:56 UTC (rev 17674)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/FormatHandler.java 2009-09-21 11:42:44 UTC (rev 17675)
@@ -26,6 +26,7 @@
import org.w3c.dom.NodeList;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.template.textformating.FormatData;
import org.jboss.tools.vpe.editor.template.textformating.TextFormatingData;
@@ -121,7 +122,7 @@
p.put("selectionProvider", selProvider); //$NON-NLS-1$
- PaletteInsertHelper.insertIntoEditor(viewer, p);
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(viewer, p);
String documentText = document.get();
int newStartOffset = documentText.substring(startOffcet).indexOf(nodeSource);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2009-09-21 11:41:56 UTC (rev 17674)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2009-09-21 11:42:44 UTC (rev 17675)
@@ -18,6 +18,7 @@
import org.jboss.tools.common.model.ui.dnd.DnDUtil;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.vpe.VpePlugin;
import org.mozilla.interfaces.nsIFile;
import org.mozilla.interfaces.nsISupports;
@@ -42,7 +43,7 @@
try {
DnDUtil.paste(input.getXModelObject(), properties);
- PaletteInsertHelper.insertIntoEditor(viewer, properties);
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(viewer, properties);
} catch (XModelException ex) {
VpePlugin.getPluginLog().logError(ex);
}
15 years, 4 months
JBoss Tools SVN: r17674 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor: dnd and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-21 07:41:56 -0400 (Mon, 21 Sep 2009)
New Revision: 17674
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
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/dnd/FileDropCommand.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Splitting PaletteInsertHelper into jsp and non-jsp related parts.
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-21 11:40:55 UTC (rev 17673)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-09-21 11:41:56 UTC (rev 17674)
@@ -126,6 +126,7 @@
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.editor.IVisualController;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPTagProposalFactory;
import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
import org.jboss.tools.jst.jsp.outline.JSPContentOutlineConfiguration;
@@ -569,7 +570,7 @@
}
public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(getSourceViewer(), p);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileDropCommand.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileDropCommand.java 2009-09-21 11:40:55 UTC (rev 17673)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileDropCommand.java 2009-09-21 11:41:56 UTC (rev 17674)
@@ -61,7 +61,7 @@
properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, getDefaultModel().getDropData().getSelectionProvider());
properties.put(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
addCustomProperties(properties);
- PaletteInsertHelper.insertIntoEditor(
+ JSPPaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java 2009-09-21 11:41:56 UTC (rev 17674)
@@ -0,0 +1,15 @@
+package org.jboss.tools.jst.jsp.jspeditor.dnd;
+
+import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
+
+public class JSPPaletteInsertHelper extends PaletteInsertHelper {
+
+ static JSPPaletteInsertHelper instance = new JSPPaletteInsertHelper();
+
+ public static JSPPaletteInsertHelper getInstance() {
+ return instance;
+ }
+
+ public JSPPaletteInsertHelper() {}
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/JSPPaletteInsertHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java 2009-09-21 11:40:55 UTC (rev 17673)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java 2009-09-21 11:41:56 UTC (rev 17674)
@@ -82,7 +82,7 @@
if(endText != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_END_TEXT, endText);
if(reformat != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, reformat);
if(newLine != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newLine);
- PaletteInsertHelper.insertIntoEditor(
+ PaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
15 years, 4 months
JBoss Tools SVN: r17673 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui: texteditors/propertyeditor and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-21 07:40:55 -0400 (Mon, 21 Sep 2009)
New Revision: 17673
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Splitting PaletteInsertHelper into jsp and non-jsp related parts.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PlainTextDropCommand.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -27,7 +27,7 @@
if(data == null) return;
Properties properties = new Properties();
properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, data);
- PaletteInsertHelper.insertIntoEditor(
+ PaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/UnknownDropCommand.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -28,7 +28,7 @@
fElementGenerator.setDataModel(getDefaultModel());
Properties properties = new Properties();
properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT,fElementGenerator.generateStartTag());
- PaletteInsertHelper.insertIntoEditor(
+ PaletteInsertHelper.getInstance().insertIntoEditor(
getDefaultModel().getDropData().getSourceViewer(),
properties
);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/propertyeditor/PropertiesTextEditorStub.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -59,7 +59,7 @@
}
public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
+ PaletteInsertHelper.getInstance().insertIntoEditor(getSourceViewer(), p);
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -385,7 +385,7 @@
}
public void insert(Properties p) {
- PaletteInsertHelper.insertIntoEditor(getSourceViewer(), p);
+ PaletteInsertHelper.getInstance().insertIntoEditor(getSourceViewer(), p);
}
public String getContext(int pos) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertHelper.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -58,7 +58,15 @@
static PaletteTaglibInserter PaletteTaglibInserter = new PaletteTaglibInserter();
- public static void insertIntoEditor(ITextEditor editor, Properties p) {
+ static PaletteInsertHelper instance = new PaletteInsertHelper();
+
+ public static PaletteInsertHelper getInstance() {
+ return instance;
+ }
+
+ public PaletteInsertHelper() {}
+
+ public void insertIntoEditor(ITextEditor editor, Properties p) {
if(editor == null) return;
if(!isEditable(editor)) {
ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
@@ -92,7 +100,7 @@
return true;
}
- public static void insertIntoEditor(final ISourceViewer v, Properties p) {
+ public void insertIntoEditor(final ISourceViewer v, Properties p) {
String tagname = p.getProperty(PROPOPERTY_TAG_NAME);
String startText = p.getProperty(PROPOPERTY_START_TEXT);
String endText = p.getProperty(PROPOPERTY_END_TEXT);
@@ -147,7 +155,7 @@
}
}
- private static void insertIntoEditorInternal(IDocument doc, Properties p) {
+ protected void insertIntoEditorInternal(IDocument doc, Properties p) {
String startText = p.getProperty(PROPOPERTY_START_TEXT);
String endText = p.getProperty(PROPOPERTY_END_TEXT);
String newline = p.getProperty(PROPOPERTY_NEW_LINE);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2009-09-21 08:10:16 UTC (rev 17672)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteViewPart.java 2009-09-21 11:40:55 UTC (rev 17673)
@@ -166,7 +166,9 @@
properties.setProperty(PaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, reformat);
properties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newline);
properties.setProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, addTaglib);
- PaletteInsertHelper.insertIntoEditor(
+
+ //TODO WARNING we cannot have here correct insert helper instance!
+ PaletteInsertHelper.getInstance().insertIntoEditor(
editor,
properties
);
15 years, 4 months
JBoss Tools SVN: r17670 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-09-18 12:56:22 -0400 (Fri, 18 Sep 2009)
New Revision: 17670
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4771
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-18 16:12:07 UTC (rev 17669)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-18 16:56:22 UTC (rev 17670)
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -121,8 +122,10 @@
try {
model = mm.getModelForRead(file);
} catch (IOException e) {
+ Activator.getDefault().logError(e);
return null;
} catch (CoreException e) {
+ Activator.getDefault().logError(e);
return null;
}
}
@@ -151,7 +154,7 @@
if(node!=null) {
return findAllVars(node);
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -173,7 +176,7 @@
if(node!=null) {
return findAllVars(node, resolver.getParserFactory());
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -186,7 +189,7 @@
if(node!=null) {
return findAllVars(node, factory);
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -324,5 +327,4 @@
}
return null;
}
-
-}
+}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-18 16:12:07 UTC (rev 17669)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-18 16:56:22 UTC (rev 17670)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -23,6 +24,7 @@
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolutionImpl;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.Var;
@@ -62,7 +64,7 @@
ELExpression operand, boolean returnEqualedVariablesOnly,
List<Var> vars, ElVarSearcher varSearcher)
throws BadLocationException, StringIndexOutOfBoundsException {
- return null;
+ return new ELResolutionImpl();
}
public ELParserFactory getParserFactory() {
@@ -70,11 +72,11 @@
}
public List<TextProposal> getProposals(ELContext context, String el) {
- return null;
+ return Collections.emptyList();
}
public ELResolution resolve(ELContext context, ELExpression operand) {
- return null;
+ return new ELResolutionImpl();
}
};
ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-09-18 16:12:07 UTC (rev 17669)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-09-18 16:56:22 UTC (rev 17670)
@@ -387,43 +387,32 @@
}
return false;
}
-
+
private void resolve(IFile file, ELExpression operand, int offset, int length){
ELResolver[] resolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
-
+
for(ELResolver resolver : resolvers){
if(!(resolver instanceof ELCompletionEngine))
continue;
-
+
SimpleELContext context = new SimpleELContext();
-
+
context.setResource(file);
context.setElResolvers(resolvers);
List<Var> vars = ElVarSearcher.findAllVars(context, offset, resolver);
-
- if(vars == null)
- continue;
-
+
context.setVars(vars);
ELResolution resolution = resolver.resolve(context, operand);
-
- if(resolution == null)
- continue;
-
+
ELSegment segment = resolution.findSegmentByOffset(offset);
-
- if(segment == null)
- continue;
- if(segment instanceof JavaMemberELSegment){
+ if(segment != null && segment instanceof JavaMemberELSegment && segment.isResolved()) {
JavaMemberELSegment javaSegment = (JavaMemberELSegment)segment;
- if(javaSegment.isResolved()){
- IJavaElement segmentJavaElement = javaSegment.getJavaElement();
- if(segmentJavaElement.equals(javaElement))
- match(file, offset, length);
- }
+ IJavaElement segmentJavaElement = javaSegment.getJavaElement();
+ if(javaElement.equals(segmentJavaElement))
+ match(file, offset, length);
}
}
}
15 years, 4 months
JBoss Tools SVN: r17669 - tags.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2009-09-18 12:12:07 -0400 (Fri, 18 Sep 2009)
New Revision: 17669
Added:
tags/jbosstools-3.0.2.GA/
Log:
tag for 3.0.2.GA
Copied: tags/jbosstools-3.0.2.GA (from rev 17668, branches/jbosstools-3.0.x)
15 years, 4 months
JBoss Tools SVN: r17668 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-18 11:17:53 -0400 (Fri, 18 Sep 2009)
New Revision: 17668
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Initial moving jsp related dnd to jst.jsp
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertManager.java 2009-09-18 15:09:26 UTC (rev 17667)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/views/palette/PaletteInsertManager.java 2009-09-18 15:17:53 UTC (rev 17668)
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.jst.web.tld.URIConstants;
public class PaletteInsertManager {
static PaletteInsertManager instance = new PaletteInsertManager();
@@ -32,8 +31,7 @@
public String getWizardName(Properties properties) {
String tagname = properties.getProperty("tag name"); //$NON-NLS-1$
- String uri = properties.getProperty(URIConstants.LIBRARY_URI);
- return getWizardName(tagname, uri);
+ return getWizardName(tagname);
}
public Object createWizardInstance(Properties properties) {
@@ -51,7 +49,7 @@
}
}
- private String getWizardName(String tagname, String uri) {
+ private String getWizardName(String tagname) {
if(tagWizards == null) {
loadWizards();
}
15 years, 4 months
JBoss Tools SVN: r17667 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-18 11:09:26 -0400 (Fri, 18 Sep 2009)
New Revision: 17667
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Initial moving jsp related dnd to jst.jsp
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-09-18 15:08:12 UTC (rev 17666)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-09-18 15:09:26 UTC (rev 17667)
@@ -82,7 +82,6 @@
import org.jboss.tools.common.model.ui.editors.dnd.DropData;
import org.jboss.tools.common.model.ui.editors.dnd.DropUtils;
import org.jboss.tools.common.model.ui.editors.dnd.IDropCommand;
-import org.jboss.tools.common.model.ui.editors.dnd.JSPTagProposalFactory;
import org.jboss.tools.common.model.ui.editors.dnd.context.InnerDragBuffer;
import org.jboss.tools.common.model.ui.util.ModelUtilities;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
@@ -91,6 +90,7 @@
import org.jboss.tools.common.resref.core.ResourceReferenceListListener;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
import org.jboss.tools.jst.jsp.editor.IVisualController;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPTagProposalFactory;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.tld.TLDUtil;
import org.jboss.tools.jst.web.tld.URIConstants;
15 years, 4 months
JBoss Tools SVN: r17666 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-18 11:08:12 -0400 (Fri, 18 Sep 2009)
New Revision: 17666
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Initial moving jsp related dnd to jst.jsp
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -19,6 +19,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagProposalsComposite;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteDropCommand;
public class DataTableWizard extends Wizard implements PropertyChangeListener,
IDropWizard {
@@ -38,7 +39,7 @@
page2 = new DataTableWizardPage();
page2.setProperties(fDropCommand.getProperties());
- TagProposal[] proposals =
+ ITagProposal[] proposals =
TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
if(TagProposalsComposite.areThereTagProposals(
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -41,6 +41,7 @@
import org.jboss.tools.jsf.model.pv.JSFPromptingProvider;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jsf.ui.Messages;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite.AttributeDescriptorValue;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -18,6 +18,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.*;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteDropCommand;
/**
* @author erick
@@ -78,7 +79,7 @@
page2 = new OutputLinkWizardPage();
- TagProposal[] proposals =
+ ITagProposal[] proposals =
TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
this.addPage(page2);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -24,6 +24,7 @@
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite.AttributeDescriptorValue;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
/**
* @author erick
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -17,6 +17,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.*;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteDropCommand;
/**
* @author erick
@@ -46,7 +47,7 @@
super.addPages();
page2 = new PanelGridWizardPage();
- TagProposal[] proposals = TagProposalsComposite.getTagProposals(
+ ITagProposal[] proposals = TagProposalsComposite.getTagProposals(
getMimeType(), getMimeData(), fDropCommand
.getTagProposalFactory());
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -19,6 +19,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite.AttributeDescriptorValue;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
/**
* @author erick
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -18,6 +18,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.*;
import org.jboss.tools.common.model.ui.editors.dnd.composite.*;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteDropCommand;
/**
* @author erick
@@ -79,7 +80,7 @@
page2 = new SelectItemsWizardPage();
- TagProposal[] proposals = TagProposalsComposite.getTagProposals(
+ ITagProposal[] proposals = TagProposalsComposite.getTagProposals(
getMimeType(), getMimeData(), fDropCommand
.getTagProposalFactory());
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java 2009-09-18 15:06:17 UTC (rev 17665)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java 2009-09-18 15:08:12 UTC (rev 17666)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.meta.action.impl.XEntityDataImpl;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.editors.dnd.*;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
/**
* @author erick
15 years, 4 months
JBoss Tools SVN: r17665 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/model/ui/editors/dnd and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-18 11:06:17 -0400 (Fri, 18 Sep 2009)
New Revision: 17665
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposal.java
Removed:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileTagProposalLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagProposal.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ExternalDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/IDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposalLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/NullProposalLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4913
Initial moving jsp related dnd to jst.jsp
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-09-18 15:06:17 UTC (rev 17665)
@@ -375,8 +375,6 @@
class="org.jboss.tools.common.model.ui.dnd.ModelTransfer"/>
<xclass id="org.jboss.tools.common.model.ui.editor.EditorPartWrapper"
class="org.jboss.tools.common.model.ui.editor.EditorPartWrapper"/>
- <xclass id="org.jboss.tools.common.model.ui.editors.dnd.DefaultDropCommandRunner"
- class="org.jboss.tools.common.model.ui.editors.dnd.DefaultDropCommandRunner"/>
<xclass id="org.jboss.tools.common.model.ui.editors.dnd.DropWizardMessages"
class="org.jboss.tools.common.model.ui.editors.dnd.DropWizardMessages"/>
<xclass id="org.jboss.tools.common.model.ui.forms.AnyElementForm"
@@ -452,6 +450,11 @@
<xclass id="org.jboss.tools.common.model.ui.wizard.newfile.WizardInvoker"
class="org.jboss.tools.common.model.ui.wizard.newfile.WizardInvoker"/>
+ <xclass id="org.jboss.tools.common.model.ui.editors.dnd.UnknownDropCommand"
+ class="org.jboss.tools.common.model.ui.editors.dnd.UnknownDropCommand"/>
+ <xclass id="org.jboss.tools.common.model.ui.editors.dnd.PlainTextDropCommand"
+ class="org.jboss.tools.common.model.ui.editors.dnd.PlainTextDropCommand"/>
+
</extension>
<extension
point="org.eclipse.ui.activities">
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommand.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -64,7 +64,7 @@
if(getDefaultModel().getDropData()==null) {
throw new IllegalStateException("Wizard model isn't intialized, call setDropDataFirst"); //$NON-NLS-1$
}
- TagProposal[] proposals
+ ITagProposal[] proposals
= TagProposalsComposite.getTagProposals(
getDefaultModel().getDropData().getMimeType(),
getDefaultModel().getDropData().getMimeData(),
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropCommandRunner.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Properties;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-import org.jboss.tools.common.meta.action.SpecialWizard;
-
-public class DefaultDropCommandRunner implements SpecialWizard {
- String flavor;
- String data;
- ITextEditor textEditor;
-
- public boolean runDropCommand(final String flavor, final String data, ITextEditor te) {
- final IEditorInput ei = te.getEditorInput();
- final ISelectionProvider sp = te.getSelectionProvider();
- final ISourceViewer sv = getSourceViewer(te);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
-// if(parentEditor.getVisualEditor().getController()!=null ) {
- DropCommandFactory.getInstance()
- .getDropCommand(flavor, JSPTagProposalFactory.getInstance())
- .execute(
- new DropData(
- flavor,
- data,
- ei,
- sv,
- sp
- )
- );
-// }
- }
- });
- return true;
- }
-
- ISourceViewer getSourceViewer(ITextEditor editor) {
- if(!(editor instanceof AbstractTextEditor)) return null;
- AbstractTextEditor ae = (AbstractTextEditor)editor;
- try {
- Method m = AbstractTextEditor.class.getDeclaredMethod("getSourceViewer", new Class[0]); //$NON-NLS-1$
- m.setAccessible(true);
- return (ISourceViewer)m.invoke(ae, new Object[0]);
- } catch (NoSuchMethodException e1) {
- return null;
- } catch (InvocationTargetException e2) {
- return null;
- } catch (IllegalAccessException e2) {
- return null;
- }
- }
-
- public int execute() {
- boolean result = runDropCommand(flavor, data, textEditor);
- return result ? 0 : 1;
- }
-
- public void setObject(Object object) {
- Properties p = (Properties)object;
- flavor = p.getProperty("flavor"); //$NON-NLS-1$
- data = p.getProperty("data"); //$NON-NLS-1$
- textEditor = (ITextEditor)p.get("textEditor"); //$NON-NLS-1$
- }
-
-}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -20,7 +20,7 @@
public class DefaultDropWizardModel implements IDropWizardModel {
- TagProposal fSelectedTagProp = UNDEFINED_TAG_PROPOSAL;
+ ITagProposal fSelectedTagProp = UNDEFINED_TAG_PROPOSAL;
DropData fDropData;
List<AttributeDescriptorValue> fAttributeValues = new ArrayList<AttributeDescriptorValue>();
boolean promptForTagAttributes = true;
@@ -31,15 +31,15 @@
this.tagProposalFactory = tagProposalFactory;
}
- public TagProposal getTagProposal() {
+ public ITagProposal getTagProposal() {
return fSelectedTagProp;
}
/**
* @see org.jboss.tools.vpe.editor.dnd.IDnDWizardDataModel#setTagProposal(org.jboss.tools.vpe.editor.dnd.TagProposal)
*/
- public void setTagProposal(TagProposal selection) {
- TagProposal oldValue = fSelectedTagProp;
+ public void setTagProposal(ITagProposal selection) {
+ ITagProposal oldValue = fSelectedTagProp;
fSelectedTagProp = selection;
doLoadTagAttributeDescriptors();
doLoadDefaultAttributeValues();
@@ -174,9 +174,10 @@
return true;
}
}
+ if(values.length > 5) return true;
return isPromptForTagAttributesRequired();
} else if(getTagProposal()==UNDEFINED_TAG_PROPOSAL){
- TagProposal[] proposals
+ ITagProposal[] proposals
= TagProposalsComposite.getTagProposals(
getDropData().getMimeType(),
getDropData().getMimeData(),
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultElementGenerator.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -34,7 +34,7 @@
}
public String generateStartTag() {
- TagProposal proposal = getWizardDataModel().getTagProposal();
+ ITagProposal proposal = getWizardDataModel().getTagProposal();
AttributeDescriptorValueProvider valueProvider = getWizardDataModel().getDropData().getValueProvider();
if(valueProvider != null) valueProvider.setProposal(proposal);
String tagName = valueProvider == null ? null : valueProvider.getTag();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropCommandFactory.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -13,6 +13,7 @@
import java.util.HashMap;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
+import org.jboss.tools.common.model.util.ModelFeatureFactory;
/**
* The Class DropCommandFactory.
@@ -49,30 +50,35 @@
/** The PACKAGE. */
static String PACKAGE = "org.jboss.tools.common.model.ui.editors.dnd."; //$NON-NLS-1$
+
+ static String UNKNOWN_DROP_COMMAND = "org.jboss.tools.common.model.ui.editors.dnd.UnknownDropCommand"; //$NON-NLS-1$
+ static String TEXT_DROP_COMMAND = "org.jboss.tools.common.model.ui.editors.dnd.PlainTextDropCommand"; //$NON-NLS-1$
+ static String FILE_DROP_COMMAND = "org.jboss.tools.jst.jsp.jspeditor.dnd.FileDropCommand"; //$NON-NLS-1$
+ static String PALETTE_DROP_COMMAND = "org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteDropCommand"; //$NON-NLS-1$
static {
fMimeCommandMap.put(
////nsITransferable.kFileMime
- kFileMime, PACKAGE + "FileDropCommand" //$NON-NLS-1$
+ kFileMime, FILE_DROP_COMMAND
);
fMimeCommandMap.put(
////nsITransferable.kURLMime
- kURLMime, PACKAGE + "FileDropCommand" //$NON-NLS-1$
+ kURLMime, FILE_DROP_COMMAND
);
fMimeCommandMap.put(
- ModelTransfer.MODEL, PACKAGE + "PaletteDropCommand" //$NON-NLS-1$
+ ModelTransfer.MODEL, PALETTE_DROP_COMMAND
);
fMimeCommandMap.put(
- "text/plain", PACKAGE + "PlainTextDropCommand" //$NON-NLS-1$ //$NON-NLS-2$
+ "text/plain", TEXT_DROP_COMMAND
);
fMimeCommandMap.put(
////nsITransferable.kUnicodeMime
- kUnicodeMime, PACKAGE + "PlainTextDropCommand" //$NON-NLS-1$
+ kUnicodeMime, TEXT_DROP_COMMAND
);
- fMimeCommandMap.put(kHtmlText,PACKAGE + "PlainTextDropCommand"); //$NON-NLS-1$
+ fMimeCommandMap.put(kHtmlText, TEXT_DROP_COMMAND);
fMimeCommandMap.put(
- UNKNOWN_MIME_TYPE, PACKAGE + "UnknownDropCommand" //$NON-NLS-1$
+ UNKNOWN_MIME_TYPE, UNKNOWN_DROP_COMMAND
);
}
@@ -95,17 +101,13 @@
*/
public IDropCommand getDropCommand(String mimeType, ITagProposalFactory tagProposalFactory) {
IDropCommand fInstance = UNKNOWN_MIME_COMMAND;
- try {
- String fClassName = (String)fMimeCommandMap.get(mimeType);
- Class newClass = this.getClass().getClassLoader().loadClass(fClassName);
- fInstance = (IDropCommand)newClass.newInstance();
+ String fClassName = (String)fMimeCommandMap.get(mimeType);
+ fInstance = (IDropCommand)ModelFeatureFactory.getInstance().createFeatureInstance(fClassName);
+ if(fInstance == null) {
+ fInstance = new UnknownDropCommand();
+ }
+ if(fInstance != null) {
fInstance.setTagProposalFactory(tagProposalFactory);
- } catch (ClassNotFoundException e) {
- //ignore
- } catch (InstantiationException e) {
- //ignore
- } catch (IllegalAccessException e) {
- //ignore
}
return fInstance;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -20,17 +20,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.IWebProject;
import org.jboss.tools.jst.web.tld.WebProjectFactory;
@@ -43,37 +37,9 @@
public static final String HTML40_URI = ""; //$NON-NLS-1$
- /**
- * Get TLD's content.
- * @param input
- * @param uri
- * @return
- */
- public static String getTldContent(IEditorInput input, String uri) {
- String tldContent = null;
- XModel xModel = null;
- if(input instanceof IModelObjectEditorInput) {
- xModel = ((IModelObjectEditorInput)input).getXModelObject().getModel();
- } else if(input instanceof IFileEditorInput) {
- IFile f = ((IFileEditorInput)input).getFile();
- XModelObject o = EclipseResourceUtil.getObjectByResource(f);
- if(o != null) xModel = o.getModel();
- }
- if(xModel != null) {
- ITaglibMapping mapping = WebProjectFactory.instance.getWebProject(xModel).getTaglibMapping();
- XModelObject xmo = mapping.getTaglibObject(uri);
- if(xmo != null) {
-// tldLocation = EclipseResourceUtil.getResource(xmo).getFullPath().toString();
- FileAnyImpl fai = (FileAnyImpl)xmo;
- tldContent = fai.getAsText();
- }
- }
- return tldContent;
- }
-
public static interface AttributeDescriptorValueProvider {
public void initContext(Properties context);
- public void setProposal(TagProposal proposal);
+ public void setProposal(ITagProposal proposal);
public String getTag();
public boolean canHaveBody();
public TagAttributesComposite.AttributeDescriptorValue[] getValues();
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropWizard.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -46,7 +46,7 @@
super.addPages();
page1 = new TagProposalsWizardPage();
page2 = new TagAttributesWizardPage();
- TagProposal[] proposals =
+ ITagProposal[] proposals =
TagProposalsComposite.getTagProposals(getMimeType(),getMimeData(), fDropCommand.getTagProposalFactory());
if(TagProposalsComposite.areThereTagProposals(
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ExternalDropWizardModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ExternalDropWizardModel.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ExternalDropWizardModel.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -41,7 +41,7 @@
protected void doLoadTagAttributeDescriptors() {
if(getTagProposal()!=UNDEFINED_TAG_PROPOSAL) {
DropData data = getDropData();
- TagProposal proposal = getTagProposal();
+ ITagProposal proposal = getTagProposal();
AttributeDescriptorValueProvider valueProvider = data.getValueProvider();
if(valueProvider != null) valueProvider.setProposal(proposal);
AttributeDescriptorValue[] values = valueProvider == null ? new AttributeDescriptorValue[0]
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileDropCommand.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileDropCommand.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.jboss.tools.common.meta.action.XActionInvoker;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
-import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
-
-/**
- *
- * @author eskimo
- */
-
-// TODO - Eskimo - Think about inserting different type of tags
-// - HTML
-// - XML(XHTML,JSP)
-
-public class FileDropCommand extends DefaultDropCommand {
-
- IElementGenerator generator;
-
- public void run(IProgressMonitor monitor) throws CoreException {
-
- generator = ElementGeneratorFactory.getInstance().getElementGenerator(getDefaultModel().getTagProposal().getUri());
- generator.setDataModel(getDefaultModel());
-
- Properties properties = new Properties();
- properties.put(PaletteInsertHelper.PROPOPERTY_TAG_NAME,getDefaultModel().getTagProposal().getName());
- properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, generateStartText());
- properties.put(PaletteInsertHelper.PROPOPERTY_END_TEXT, generateEndText());
- properties.put(PaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, getReformatBodyProperty());
- properties.put(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI,getDefaultModel().getTagProposal().getUri());
- properties.put(PaletteInsertHelper.PROPOPERTY_TAGLIBRARY_VERSION,getDefaultModel().getTagProposal().getLibraryVersion());
- properties.put(PaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX,getDefaultModel().getTagProposal().getPrefix());
- properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, getDefaultModel().getDropData().getSelectionProvider());
- properties.put(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
- addCustomProperties(properties);
- PaletteInsertHelper.insertIntoEditor(
- getDefaultModel().getDropData().getSourceViewer(),
- properties
- );
- }
-
- protected void executeUnknownTag() {
- DropData data = getDefaultModel().getDropData();
- String type = data.getMimeType();
- String mime = data.getMimeData();
- /*nsITransferable.kFileMime*/
- if("application/x-moz-file".equals(type) && mime != null) { //$NON-NLS-1$
- if(mime.startsWith("file:")) mime = mime.substring(5); //$NON-NLS-1$
- File f = new File(mime);
- IFile file = EclipseResourceUtil.getFile(f.getAbsolutePath());
- if(file == null) return;
- XModelObject o = EclipseResourceUtil.getObjectByResource(file);
- if(o == null) return;
- XActionInvoker.invoke("CopyActions.Copy", o, null); //$NON-NLS-1$
- data.setMimeType(ModelTransfer.MODEL);
- data.setMimeData(""); //$NON-NLS-1$
- DropCommandFactory.getInstance().getDropCommand(ModelTransfer.MODEL, tagProposalFactory).execute(data);
- }
- }
-
- protected void addCustomProperties(Properties properties) {}
-
- protected String getReformatBodyProperty() {
- return "yes"; //$NON-NLS-1$
- }
-
- protected IDropWizardModel createSpecificModel() {
- return new ExternalDropWizardModel(tagProposalFactory);
- }
-
- protected String generateStartText() {
- return generator.generateStartTag();
- }
-
- protected String generateEndText() {
- return generator.generateEndTag();
- }
-}
\ No newline at end of file
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileTagProposalLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileTagProposalLoader.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/FileTagProposalLoader.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.tools.common.model.ui.views.palette.PaletteTaglibInserter;
-
-public class FileTagProposalLoader implements ITagProposalLoader {
-
- private static final Map<String,TagProposal[]> extensionMap = new HashMap<String,TagProposal[]>();
-
- static TagProposal[] IMG_TAG_PROPOSALS = new TagProposal[]{
- new TagProposal(
- DropURI.JSF_HTML_URI,
- "h", //$NON-NLS-1$
- "graphicImage", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("value","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ),
- new TagProposal(
- DropURI.HTML_4_0_URI,
- TagProposal.EMPTY_PREFIX,
- "img", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("src","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ),
- new TagProposal(
- DropURI.STRUTS_HTML_URI,
- "html", //$NON-NLS-1$
- "img", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("page","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- ),
- new TagProposal(
- DropURI.SEAM_URI,
- "s", //$NON-NLS-1$
- "graphicImage", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("url","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- )
-// yradtsevich: fix of JBIDE-3984: Exclude t:graphicImage option from Insert tag dialog
-// ,
-// new TagProposal(
-// DropURI.TOMOHAWK_URI,
-// "t",
-// "graphicImage",
-// new AbsoluteFilePathAttributeValueLoader("url","","")
-// )
- };
-
- static TagProposal[] CSS_TAG_PROPOSALS = new TagProposal[]{
- new TagProposal(
- DropURI.HTML_4_0_URI,
- TagProposal.EMPTY_PREFIX,
- "link", //$NON-NLS-1$
- new CssLinkAttributeValueLoader("href") //$NON-NLS-1$
- ),
- };
-
- static TagProposal JSP_INCLUDE = new TagProposal(
- DropURI.JSP_URI,
- "jsp", //$NON-NLS-1$
- "include", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("page","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- );
-
- static TagProposal JSP_FORWARD = new TagProposal(
- DropURI.JSP_URI,
- "jsp", //$NON-NLS-1$
- "forward", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("page","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- );
-
- static TagProposal UI_INCLUDE = new TagProposal(
- PaletteTaglibInserter.faceletUri,
- "ui", //$NON-NLS-1$
- "include", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("src","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- );
-
- static TagProposal S_DECORATE = new TagProposal(
- DropURI.SEAM_URI,
- "s", //$NON-NLS-1$
- "decorate", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("template","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- );
-
- static TagProposal[] PAGE_TAG_PROPOSALS = new TagProposal[]{
- JSP_INCLUDE,
- JSP_FORWARD
- };
-
- static TagProposal[] XHTML_PAGE_TAG_PROPOSALS = new TagProposal[]{
- JSP_INCLUDE,
- JSP_FORWARD,
- UI_INCLUDE,
- S_DECORATE
- };
-
- static {
- // There is the question here what store HTML or TLD will been asked about TagDescription
- extensionMap.put("jpg", IMG_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put("jpeg", IMG_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put("gif",IMG_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put("bmp",IMG_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put("png",IMG_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put("jsp",PAGE_TAG_PROPOSALS); //$NON-NLS-1$
- extensionMap.put("html",PAGE_TAG_PROPOSALS); //$NON-NLS-1$
- extensionMap.put("xhtml",XHTML_PAGE_TAG_PROPOSALS); //$NON-NLS-1$
-
- extensionMap.put(
- "properties",new TagProposal[]{ //$NON-NLS-1$
- new TagProposal(
- DropURI.JSF_CORE_URI,
- "f", //$NON-NLS-1$
- "loadBundle", //$NON-NLS-1$
- new LoadBundleBaseNameAttributeValueLoader()
- )
- }
- );
- extensionMap.put("css",CSS_TAG_PROPOSALS); //$NON-NLS-1$
- extensionMap.put(
- "inc", new TagProposal[]{ //$NON-NLS-1$
- new TagProposal(
- DropURI.JSP_URI,
- "jsp", //$NON-NLS-1$
- "include", //$NON-NLS-1$
- new AbsoluteFilePathAttributeValueLoader("page","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- )
- }
- );
-
- }
-
- public static boolean isExtensionMapped(String extension) {
- return extension != null && extensionMap.containsKey(extension.toLowerCase());
- }
-
- public TagProposal[] getTagProposals(Object data) {
- String fileName = data.toString();
- String extension = fileName.substring(fileName.lastIndexOf(".")+1); //$NON-NLS-1$
- TagProposal[] tagProposals = (TagProposal[])extensionMap.get(extension.toLowerCase());
- if(tagProposals==null) {
- tagProposals = new TagProposal[0];
- }
- return tagProposals;
- }
-
- public boolean isTagProposalExists(Object data) {
- return true;
- }
-
- public static class ImageFileAttributesValuesLoader implements IAttributeValueLoader {
-
- public void fillTagAttributes(IDropWizardModel model) {
- }
-
- }
-
- public static class JspFileAttributesValuesLoader implements IAttributeValueLoader {
-
- public void fillTagAttributes(IDropWizardModel model) {
- }
- }
-}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/IDropWizardModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/IDropWizardModel.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/IDropWizardModel.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -25,16 +25,35 @@
public static final String TAG_PROPOSAL = "tagProposal"; //$NON-NLS-1$
public static final String ATTRIBUTE_VALUE = "attributeValue"; //$NON-NLS-1$
-
- public static final TagProposal UNDEFINED_TAG_PROPOSAL = new TagProposal("http://www.redhat.com/undefined","",""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ public static final ITagProposal UNDEFINED_TAG_PROPOSAL = new ITagProposal() {
+ public IAttributeValueLoader getAttributesValueLoader() {
+ return EMPTY_ATTRIBUTE_VALUE_LOADER;
+ }
+ public String getDetails() {
+ return "http://www.redhat.com/undefined";
+ }
+ public String getDisplayString() {
+ return EMPTY_PREFIX;
+ }
+
+ public String getName() {
+ return EMPTY_PREFIX;
+ }
+
+ public String getPrefix() {
+ return EMPTY_PREFIX;
+ }
+
+ };
+
/*
* Methods
*/
- public TagProposal getTagProposal();
+ public ITagProposal getTagProposal();
- public void setTagProposal(TagProposal selection);
+ public void setTagProposal(ITagProposal selection);
public void setAttributeValue(AttributeDescriptorValue name, Object value);
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposal.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposal.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -0,0 +1,21 @@
+package org.jboss.tools.common.model.ui.editors.dnd;
+
+public interface ITagProposal {
+ public static final IAttributeValueLoader EMPTY_ATTRIBUTE_VALUE_LOADER = new IAttributeValueLoader() {
+ public void fillTagAttributes(IDropWizardModel model) {
+ // do nothing
+ }
+ };
+ public static String EMPTY_PREFIX = "";
+
+ public String getName();
+
+ public String getPrefix();
+
+ public IAttributeValueLoader getAttributesValueLoader();
+
+ public String getDisplayString();
+
+ public String getDetails();
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposalLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposalLoader.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/ITagProposalLoader.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -11,6 +11,6 @@
package org.jboss.tools.common.model.ui.editors.dnd;
public interface ITagProposalLoader {
- public TagProposal[] getTagProposals(Object data);
+ public ITagProposal[] getTagProposals(Object data);
public boolean isTagProposalExists(Object data);
}
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/JSPTagProposalFactory.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-
-public class JSPTagProposalFactory implements ITagProposalFactory {
- private static final JSPTagProposalFactory INSTANCE = new JSPTagProposalFactory();
- public static Map<String,String> loaderMap = new HashMap<String,String>();
-
- static {
- loaderMap.put(DropCommandFactory.kFileMime, DropCommandFactory.PACKAGE + "FileTagProposalLoader"); //$NON-NLS-1$
- loaderMap.put(DropCommandFactory.kURLMime, DropCommandFactory.PACKAGE + "FileTagProposalLoader"); //$NON-NLS-1$
- }
-
- public static JSPTagProposalFactory getInstance() {
- return INSTANCE;
- }
-
- private JSPTagProposalFactory() {
- }
-
- public ITagProposalLoader getProposalLoader(String mimeType) {
- ITagProposalLoader fInstance = DEFAULT_PROPOSAL_LOADER;
- try {
- String fClassName = (String)loaderMap.get(mimeType);
- if(fClassName == null) {
- //No need to report, just there is no specific proposal loader for this myme type.
- return fInstance;
- }
- Class newClass = this.getClass().getClassLoader().loadClass(fClassName);
- fInstance = (ITagProposalLoader)newClass.newInstance();
- } catch (InstantiationException e) {
- ModelUIPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- ModelUIPlugin.getPluginLog().logError(e);
- } catch (ClassNotFoundException e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
- return fInstance;
- }
-}
-
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/NullProposalLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/NullProposalLoader.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/NullProposalLoader.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -12,8 +12,8 @@
public class NullProposalLoader implements ITagProposalLoader {
- public TagProposal[] getTagProposals(Object data) {
- return new TagProposal[0];
+ public ITagProposal[] getTagProposals(Object data) {
+ return new ITagProposal[0];
}
public boolean isTagProposalExists(Object data) {
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/PaletteDropCommand.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,330 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-import java.util.Properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
-import org.jboss.tools.common.model.ui.ModelUIPlugin;
-import org.jboss.tools.common.model.ui.dnd.DnDUtil;
-import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
-import org.jboss.tools.common.model.ui.editors.dnd.composite.TagAttributesComposite.AttributeDescriptorValue;
-import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
-import org.jboss.tools.common.model.ui.views.palette.PaletteInsertManager;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.tld.IWebProject;
-import org.jboss.tools.jst.web.tld.TLDToPaletteHelper;
-import org.jboss.tools.jst.web.tld.URIConstants;
-import org.jboss.tools.jst.web.tld.WebProjectFactory;
-
-/**
- *
- * @author eskimo
- */
-public class PaletteDropCommand extends FileDropCommand {
- Properties initialValues = new Properties();
- String startText;
- String endText;
- String newLine;
- String reformat = "no"; //$NON-NLS-1$
-
- Properties properties = new Properties();
- boolean callPaletteWizard = false;
-
- /**
- *
- */
- protected IDropWizardModel createSpecificModel() {
- return new PaletteDropWizardModel(tagProposalFactory);
- }
-
- protected void addCustomProperties(Properties runningProperties) {
- newLine = properties.getProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE);
- if (newLine == null) newLine="true"; //$NON-NLS-1$
- runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newLine);
- String addTaglib = properties.getProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB);
- if(addTaglib == null) addTaglib = "true"; //$NON-NLS-1$
- runningProperties.setProperty(PaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, addTaglib);
- }
-
- public void execute() {
- if(getDefaultModel().getTagProposal() == IDropWizardModel.UNDEFINED_TAG_PROPOSAL) {
- if(startText == null && endText == null) return;
- int pos = ((ITextSelection)getDefaultModel().getDropData().getSelectionProvider().getSelection()).getOffset();
- getDefaultModel().getDropData().getSourceViewer().setSelectedRange(pos, 0);
- if(startText != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_START_TEXT, startText);
- if(endText != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_END_TEXT, endText);
- if(reformat != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_REFORMAT_BODY, reformat);
- if(newLine != null) properties.setProperty(PaletteInsertHelper.PROPOPERTY_NEW_LINE, newLine);
- PaletteInsertHelper.insertIntoEditor(
- getDefaultModel().getDropData().getSourceViewer(),
- properties
- );
- } else {
- DropData data = getDefaultModel().getDropData();
- ISourceViewer viewer = data.getSourceViewer();
- if(data.getContainer() != null){
- if (data.getContainer() instanceof ElementImpl) {
- ElementImpl container = (ElementImpl)data.getContainer();
- if(!container.hasEndTag()){
- try{
- IDocument document = viewer.getDocument();
- int containerOffset = container.getStartOffset();
- int containerLenght = container.getStartEndOffset()-containerOffset;
- String containerString = document.get(containerOffset, containerLenght);
- int slashPosition = containerString.lastIndexOf("/"); //$NON-NLS-1$
- if(slashPosition >= 0){
- int deltaOffset = (containerString.length()-1)-slashPosition;
- String text = ""; //$NON-NLS-1$
- for(int i=0; i < deltaOffset;i++) text += " "; //$NON-NLS-1$
- text += "></"+container.getNodeName()+">"; //$NON-NLS-1$ //$NON-NLS-2$
- document.replace(containerOffset+slashPosition, containerString.length()-slashPosition, text);
- }
- }catch(BadLocationException ex){
- ModelUIPlugin.getPluginLog().logError(ex);
- }
- }
- }
- }
- super.execute();
- }
- }
-
- public void initialize() {
- DropData data = getDefaultModel().getDropData();
-
- IEditorInput input = data.getEditorInput();
- XModelObject target = null;
- IFile f = null;
- if(input instanceof IFileEditorInput) {
- f = ((IFileEditorInput)input).getFile();
- target = EclipseResourceUtil.getObjectByResource(f);
- if(target == null && f.exists()) {
- target = EclipseResourceUtil.createObjectForResource(f);
- }
- } else if(input instanceof IModelObjectEditorInput) {
- target = ((IModelObjectEditorInput)input).getXModelObject();
- }
- if(target == null) {
- initialize2();
- } else {
- ISourceViewer viewer = data.getSourceViewer();
-
- properties = new Properties();
- properties.put("viewer", viewer); //$NON-NLS-1$
- properties.setProperty("text", viewer.getDocument().get()); //$NON-NLS-1$
- properties.setProperty("isDrop", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.setProperty("actionSourceGUIComponentID", "editor"); //$NON-NLS-1$ //$NON-NLS-2$
- properties.setProperty("accepsAsString", "true"); //$NON-NLS-1$ //$NON-NLS-2$
-
- if(f != null) {
- properties.put("file", f); //$NON-NLS-1$
- }
- ISelection selection = data.getSelectionProvider().getSelection();
-
- int offset = 0;
- //int length = 0;
- if(selection instanceof ITextSelection) {
- offset = ((ITextSelection)selection).getOffset();
- //length = ((ITextSelection)selection).getLength();
- } else {
- offset = viewer.getTextWidget().getCaretOffset();
- }
- properties.setProperty("pos", "" + offset); //$NON-NLS-1$ //$NON-NLS-2$
- if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object so = ((IStructuredSelection)selection).getFirstElement();
- if(so instanceof IDOMElement) {
- String en = ((IDOMElement)so).getNodeName();
- properties.setProperty("context:tagName", en); //$NON-NLS-1$
- String attrName = data.getAttributeName();
- if(attrName != null) {
- properties.setProperty("context:attrName", attrName); //$NON-NLS-1$
- }
- }
- }
- try {
- if(DnDUtil.isPasteEnabled(target)) {
- DnDUtil.paste(target, properties);
- } else {
- XModelObject s = PreferenceModelUtilities.getPreferenceModel().getModelBuffer().source();
- if(s != null) {
- properties.setProperty("start text", "" + getDefaultText(s)); //$NON-NLS-1$ //$NON-NLS-2$
- properties.setProperty("end text", ""); //$NON-NLS-1$ //$NON-NLS-2$
- properties.setProperty("new line", "newLine"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- } catch (CoreException e) {
- ModelUIPlugin.getPluginLog().logError(e);
- }
- startText = properties.getProperty(TLDToPaletteHelper.START_TEXT);
- endText = properties.getProperty(TLDToPaletteHelper.END_TEXT);
- reformat = properties.getProperty(TLDToPaletteHelper.REFORMAT);
- String uri = properties.getProperty(URIConstants.LIBRARY_URI);
- String libraryVersion = properties.getProperty(URIConstants.LIBRARY_VERSION);
- String defaultPrefix = properties.getProperty(URIConstants.DEFAULT_PREFIX);
- String tagname = properties.getProperty("tag name"); //$NON-NLS-1$
-
- callPaletteWizard = PaletteInsertManager.getInstance().getWizardName(properties) != null;
-
- boolean isWizardEnabled = (!"FileJAVA".equals(target.getModelEntity().getName())); //$NON-NLS-1$
- if(getDefaultModel() instanceof PaletteDropWizardModel) {
- ((PaletteDropWizardModel)getDefaultModel()).setWizardEnabled(isWizardEnabled);
- }
-
- if(uri == null || tagname == null) {
- getDefaultModel().setTagProposal(IDropWizardModel.UNDEFINED_TAG_PROPOSAL);
- } else {
- getDefaultModel().setTagProposal(new TagProposal(uri, libraryVersion, defaultPrefix, tagname));
- insertInitialValues();
- }
- }
- }
-
- private void initialize2() {
- XModelObject object = PreferenceModelUtilities.getPreferenceModel().getModelBuffer().source();
- String tagname = object.getAttributeValue("name"); //$NON-NLS-1$
- XModelObject parent = object.getParent();
- String uri = (parent == null) ? "" : parent.getAttributeValue(URIConstants.LIBRARY_URI); //$NON-NLS-1$
- String libraryVersion = (parent == null) ? "" : parent.getAttributeValue(URIConstants.LIBRARY_VERSION); //$NON-NLS-1$
- String defaultPrefix = (parent == null) ? "" : parent.getAttributeValue(URIConstants.DEFAULT_PREFIX); //$NON-NLS-1$
- this.getDefaultModel().setTagProposal(new TagProposal(uri, libraryVersion,defaultPrefix,tagname));
- startText = object.getAttributeValue("start text"); //$NON-NLS-1$
- endText = object.getAttributeValue("end text"); //$NON-NLS-1$
- }
-
- private void insertInitialValues() {
- parseInitialValues(startText);
- AttributeDescriptorValue[] vs = getDefaultModel().getAttributeValueDescriptors();
- for (int i = 0; i < vs.length; i++) {
- String v = initialValues.getProperty(vs[i].getName());
- if(v != null) vs[i].setValue(v);
- }
- }
-
- private void parseInitialValues(String startText) {
- if(startText == null || startText.length() == 0) return;
- int bi = startText.indexOf('<');
- if(bi < 0) return;
- int ei = startText.indexOf('>', bi);
- if(ei < 0) return;
- String header = startText.substring(bi + 1, ei);
- int NOTHING = 0;
- int ATT_NAME = 1;
- int ATT_VALUE = 2;
- char quote = '\0';
- int state = NOTHING;
- String name = null;
- String value = null;
- for (int i = 0; i < header.length(); i++) {
- char c = header.charAt(i);
- if(state == NOTHING) {
- if(Character.isJavaIdentifierStart(c)) {
- name = "" + c; //$NON-NLS-1$
- state = ATT_NAME;
- }
- } else if(state == ATT_NAME) {
- if(Character.isJavaIdentifierPart(c) || c == ':') {
- name += c;
- } else if(c == '=') {
- state = ATT_VALUE;
- quote = '\0';
- }
- } else if(state == ATT_VALUE) {
- if(c == quote) {
- initialValues.setProperty(name, value);
- name = null;
- value = null;
- state = NOTHING;
- quote = '\0';
- } else if(c == '"' || c == '\'') {
- quote = c;
- value = ""; //$NON-NLS-1$
- } else if(quote != '\0') {
- value += c;
- }
- }
- }
- }
-
- protected String generateStartText() {
- startText = properties.getProperty("start text"); //$NON-NLS-1$
- if(getDefaultModel().getTagProposal()==IDropWizardModel.UNDEFINED_TAG_PROPOSAL
- || getDefaultModel().getTagProposal().getUri().length() == 0) {
- return startText;
- }
- String s1 = super.generateStartText();
- String s2 = startText;
- if(s2 == null) return s1;
- if(s1.indexOf('=') < 0) return s2; // no input
- int bi1 = s1.indexOf('<');
- int bi2 = s2.indexOf('<');
- if(bi2 < 0 || bi1 < 0) return s2;
- int ei1 = s1.indexOf('>', bi1);
- int ei2 = s2.indexOf('>', bi2);
- if(ei1 < 0 || ei2 < 0) return s1;
- boolean slash1 = s1.charAt(ei1 - 1) == '/';
- boolean slash2 = s2.charAt(ei2 - 1) == '/';
- if(slash1 && !slash2) {
- s2 = s2.substring(0, bi2) + s1.substring(bi1, ei1 - 1) + s2.substring(ei2);
- } else if(!slash1 && slash2) {
- s2 = s2.substring(0, bi2) + s1.substring(bi1, ei1) + s2.substring(ei2 - 1);
- } else {
- s2 = s2.substring(0, bi2) + s1.substring(bi1, ei1) + s2.substring(ei2);
- }
- return s2;
- }
-
- protected String generateEndText() {
- endText = properties.getProperty("end text"); //$NON-NLS-1$
- return (endText != null) ? endText : ""; //$NON-NLS-1$
- }
-
- protected String getReformatBodyProperty() {
- return reformat;
- }
-
- protected IDropWizard createDropWizard() {
- String wizardName = PaletteInsertManager.getInstance().getWizardName(properties);
-
- IDropWizard wizard = null;
- if(wizardName != null) {
- wizard = (IDropWizard)PaletteInsertManager.getInstance().createWizardInstance(properties);
- }
- if(wizard == null) wizard = new DropWizard();
- wizard.setCommand(this);
- return wizard;
- }
-
- public Properties getProperties() {
- return properties;
- }
-
- private String getDefaultText(XModelObject o) {
- if(o == null) return ""; //$NON-NLS-1$
- if(o.getFileType() != XModelObject.FILE) return o.getPresentationString();
- IWebProject p = WebProjectFactory.instance.getWebProject(o.getModel());
- String path = p.getPathInWebRoot(o);
- return path == null ? o.getPresentationString() : path;
- }
-}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -119,10 +119,10 @@
*
*/
protected void updateTitle() {
- TagProposal tagProposal = (TagProposal)getDropWizardModel().getTagProposal();
+ ITagProposal tagProposal = getDropWizardModel().getTagProposal();
StringBuffer titleText = new StringBuffer();
titleText.append("<"); //$NON-NLS-1$
- if(!TagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
+ if(!ITagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
titleText
.append(tagProposal.getPrefix())
.append(":"); //$NON-NLS-1$
Deleted: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagProposal.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagProposal.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagProposal.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.common.model.ui.editors.dnd;
-
-public class TagProposal {
-
- public static final String EMPTY_PREFIX = ""; //$NON-NLS-1$
- public static final String EMPTY_URI = ""; //$NON-NLS-1$
-
- public static final IAttributeValueLoader EMPTY_ATTRIBUTE_VALUE_LOADER = new IAttributeValueLoader() {
- public void fillTagAttributes(IDropWizardModel model) {
- // do nothing
- }
- };
-
- String uri;
- String libraryVersion = ""; //$NON-NLS-1$
- String prefix;
- String name;
- IAttributeValueLoader attributeValueLoader = EMPTY_ATTRIBUTE_VALUE_LOADER;
-
- /**
- * TagProposal with empty attribute value loader
- *
- */
- public TagProposal(
- String uri,
- String prefix,
- String name
- ) {
- this(uri, "", prefix, name); //$NON-NLS-1$
- }
-
- public TagProposal(
- String uri,
- String libraryVersion,
- String prefix,
- String name
- ) {
- this.uri = uri;
- this.libraryVersion = (libraryVersion == null) ? "" : libraryVersion; //$NON-NLS-1$
- this.prefix = prefix;
- this.name = name;
- }
-
- /**
- *
- *
- */
- public TagProposal(
- String uri,
- String prefix,
- String name,
- IAttributeValueLoader loader
- ) {
- this.uri = uri;
- this.prefix = prefix;
- this.name = name;
- this.attributeValueLoader = loader;
- }
-
- /**
- *
- * @return
- */
- public String getName() {
- return name;
- }
-
- /**
- *
- * @return
- */
- public String getPrefix() {
- return prefix;
- }
-
- /**
- *
- * @return
- */
- public String getUri() {
- return uri;
- }
-
- public String getLibraryVersion() {
- return libraryVersion;
- }
-
- public IAttributeValueLoader getAttributesValueLoader() {
- return attributeValueLoader;
- }
-}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -225,7 +225,7 @@
context.setProperty("attributeName", attrDescr.getName()); //$NON-NLS-1$
String tagName = "" + fWizardModel.getTagProposal().getName(); //$NON-NLS-1$
String prefix = fWizardModel.getTagProposal().getPrefix();
- if(prefix != null && prefix.length() > 0 && !tagName.startsWith("prefix" + ":")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if(prefix != null && prefix.length() > 0 && !tagName.startsWith(prefix + ":")) { //$NON-NLS-1$ //$NON-NLS-2$
tagName = prefix + ":" + tagName; //$NON-NLS-1$
}
context.setProperty("nodeName", tagName); //$NON-NLS-1$
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagProposalsComposite.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -27,23 +27,16 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
+import org.jboss.tools.common.model.ui.editors.dnd.ITagProposal;
import org.jboss.tools.common.model.ui.editors.dnd.ITagProposalFactory;
-import org.jboss.tools.common.model.ui.editors.dnd.TagProposal;
public class TagProposalsComposite extends Composite {
- private TagProposal selection = IDropWizardModel.UNDEFINED_TAG_PROPOSAL;
+ private ITagProposal selection = IDropWizardModel.UNDEFINED_TAG_PROPOSAL;
CheckboxTableViewer tableTreeViewer;
- TagProposal[] fTagProposals;
+ ITagProposal[] fTagProposals;
IDropWizardModel fModel;
-// public interface ITagProposalSelectionListener {
-// public void tagProposalSelected(TagProposal pproposal);
-// }
-
-// private ITagProposalSelectionListener listener = null;
-// private String fMimeType;
-
public TagProposalsComposite(Composite parent, int styles,IDropWizardModel model) {
super(parent,styles);
fModel = model;
@@ -90,7 +83,7 @@
tableTreeViewer.addCheckStateListener(
new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
- TagProposal proposal = (TagProposal) event.getElement();
+ ITagProposal proposal = (ITagProposal)event.getElement();
if (event.getChecked()) {
if(selection!=IDropWizardModel.UNDEFINED_TAG_PROPOSAL) {
tableTreeViewer.setChecked(selection, false);
@@ -130,13 +123,13 @@
}
public String getColumnText(Object element, int columnIndex) {
- TagProposal prop = (TagProposal)element;
+ ITagProposal prop = (ITagProposal)element;
switch (columnIndex) {
case TAG_NAME_INDEX:
- return prop.getPrefix()==TagProposal.EMPTY_PREFIX?prop.getName():prop.getPrefix()+":"+prop.getName(); //$NON-NLS-1$
+ return prop.getDisplayString();
case TAG_URI_INDEX:
- return prop.getUri();
+ return prop.getDetails();
}
throw new IllegalArgumentException("Wrong column index for LabelProvider"); //$NON-NLS-1$
}
@@ -162,7 +155,7 @@
/// listener = l;
/// }
- public TagProposal[] getTagProposals() {
+ public ITagProposal[] getTagProposals() {
return fTagProposals;
}
@@ -174,7 +167,7 @@
return tagProposalFactory.getProposalLoader(mimeType).getTagProposals(dropData).length>0;
}
- public static TagProposal[] getTagProposals(String mimeType,String dropData, ITagProposalFactory tagProposalFactory) {
+ public static ITagProposal[] getTagProposals(String mimeType,String dropData, ITagProposalFactory tagProposalFactory) {
return tagProposalFactory.getProposalLoader(mimeType).getTagProposals(dropData);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java 2009-09-18 15:03:45 UTC (rev 17664)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/context/DropContext.java 2009-09-18 15:06:17 UTC (rev 17665)
@@ -12,6 +12,8 @@
import java.io.File;
import java.net.MalformedURLException;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -35,7 +37,6 @@
import org.jboss.tools.common.model.ui.dnd.VpeDnDEvent;
import org.jboss.tools.common.model.ui.dnd.VpeTextDropAction;
import org.jboss.tools.common.model.ui.editors.dnd.DropUtils;
-import org.jboss.tools.common.model.ui.editors.dnd.FileTagProposalLoader;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.web.tld.TLDUtil;
@@ -160,13 +161,19 @@
}
event = null;
}
+
+ //see FileTagProposalLoader
+ public static Set<String> mappedExtensions = new HashSet<String>();
+ public static boolean isExtensionMapped(String extension) {
+ return extension != null && mappedExtensions.contains(extension.toLowerCase());
+ }
private boolean dropAsFileObject(XModelObject o) {
if(o == null) return false;
if(o.getFileType() != XModelObject.FILE || isOverAttributeValue) return false;
if(TLDUtil.isTaglib(o)) return false;
String extension = o.getAttributeValue("extension"); //$NON-NLS-1$
- return extension != null && FileTagProposalLoader.isExtensionMapped(extension);
+ return extension != null && isExtensionMapped(extension);
}
class TransferHolder {
15 years, 4 months
JBoss Tools SVN: r17664 - in trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css: view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2009-09-18 11:03:45 -0400 (Fri, 18 Sep 2009)
New Revision: 17664
Removed:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4849
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-09-18 15:03:39 UTC (rev 17663)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2009-09-18 15:03:45 UTC (rev 17664)
@@ -99,6 +99,8 @@
|| (!selectedObject.equals(newSelectedObject)))
super.selectionChanged(part, selection);
selectedObject = newSelectedObject;
+
+ update();
}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java 2009-09-18 15:03:39 UTC (rev 17663)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TypeMapper.java 2009-09-18 15:03:45 UTC (rev 17664)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.css.properties;
-
-import org.eclipse.ui.views.properties.tabbed.ITypeMapper;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public class TypeMapper implements ITypeMapper {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.views.properties.tabbed.ITypeMapper#mapType(java.lang.
- * Object)
- */
- public Class mapType(Object object) {
-
- while (object instanceof ICSSNode) {
- if ((object instanceof ICSSStyleRule)
- || (((ICSSNode) object).getParentNode() == null)) {
- break;
- } else {
- object = ((ICSSNode) object).getParentNode();
- }
- }
- return object.getClass();
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2009-09-18 15:03:39 UTC (rev 17663)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2009-09-18 15:03:45 UTC (rev 17664)
@@ -11,24 +11,27 @@
package org.jboss.tools.jst.css.view;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.IContributedContentsView;
import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.PropertySheet;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.jboss.tools.jst.css.common.CSSSelectionListener;
+import org.jboss.tools.jst.css.common.CSSStyleListener;
+import org.jboss.tools.jst.css.common.ICSSViewListner;
+import org.jboss.tools.jst.css.common.StyleContainer;
import org.jboss.tools.jst.css.properties.CSSPropertyPage;
/**
* @author Sergey Dzmitrovich
*
*/
-public class CSSEditorView extends PropertySheet {
+public class CSSEditorView extends PropertySheet implements ICSSViewListner {
static public String CONTRIBUTOR_ID = "org.eclipse.wst.css.core.csssource.source"; //$NON-NLS-1$
@@ -37,33 +40,22 @@
super.init(site);
getSite().getPage().removeSelectionListener(this);
- CSSSelectionListener.getInstance().addSelectionListener(this);
+ CSSStyleListener.getInstance().addSelectionListener(this);
}
@Override
public void dispose() {
super.dispose();
- CSSSelectionListener.getInstance().removeSelectionListener(this);
+ CSSStyleListener.getInstance().removeSelectionListener(this);
}
@Override
- public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- super.selectionChanged(part, sel);
-
- // TODO find better way to react upon changing of node i source editor.
- // Description of problem: when node is been editing PropertySheet will
- // not send selection event to page as selection is same;
- if (getCurrentPage() instanceof CSSPropertyPage)
- ((CSSPropertyPage) getCurrentPage()).update();
- }
-
- @Override
protected PageRec doCreatePage(final IWorkbenchPart part) {
- if (part instanceof PropertySheet) {
- return null;
- }
+ // if (part instanceof PropertySheet) {
+ // return null;
+ // }
IPropertySheetPage page = new CSSPropertyPage(
new ITabbedPropertySheetPageContributor() {
@@ -102,4 +94,16 @@
}
return super.getAdapter(key);
}
+
+ public void styleChanged(StyleContainer styleContainer) {
+ if (getCurrentPage() instanceof CSSPropertyPage)
+ ((CSSPropertyPage) getCurrentPage()).update();
+
+ }
+ @Override
+ protected boolean isImportant(IWorkbenchPart part) {
+ if ((part instanceof IEditorPart) || (part instanceof ContentOutline))
+ return true;
+ return false;
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2009-09-18 15:03:39 UTC (rev 17663)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2009-09-18 15:03:45 UTC (rev 17664)
@@ -11,6 +11,7 @@
package org.jboss.tools.jst.css.view;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -27,12 +28,12 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.ViewPart;
-import org.jboss.tools.jst.css.common.CSSSelectionListener;
+import org.jboss.tools.jst.css.common.CSSStyleListener;
+import org.jboss.tools.jst.css.common.ICSSViewListner;
import org.jboss.tools.jst.css.common.StyleContainer;
import org.jboss.tools.jst.css.messages.CSSUIMessages;
import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
@@ -41,7 +42,7 @@
* @author Sergey Dzmitrovich
*
*/
-public class CSSPreview extends ViewPart implements ISelectionListener {
+public class CSSPreview extends ViewPart implements ICSSViewListner {
private Browser browser;
@@ -57,13 +58,13 @@
public void init(IViewSite site) throws PartInitException {
super.init(site);
- CSSSelectionListener.getInstance().addSelectionListener(this);
+ CSSStyleListener.getInstance().addSelectionListener(this);
}
@Override
public void dispose() {
- CSSSelectionListener.getInstance().removeSelectionListener(this);
+ CSSStyleListener.getInstance().removeSelectionListener(this);
super.dispose();
}
@@ -155,23 +156,19 @@
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (selection instanceof IStructuredSelection) {
+ Map<String, String> newAttributes;
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
if (structuredSelection.getFirstElement() instanceof StyleContainer) {
- styleAttributes = ((StyleContainer) structuredSelection
+ newAttributes = ((StyleContainer) structuredSelection
.getFirstElement()).getStyleAttributes();
} else {
- styleAttributes.clear();
+ newAttributes = Collections.EMPTY_MAP;
}
- String newStyle = getStyle(styleAttributes);
- if (!newStyle.equals(currentStyle)) {
+ updateView(newAttributes);
- currentStyle = newStyle;
- updateBrowser();
- }
-
}
}
@@ -196,4 +193,17 @@
public String getCurrentStyle() {
return currentStyle;
}
+
+ public void styleChanged(StyleContainer styleContainer) {
+ updateView(styleContainer.getStyleAttributes());
+
+ }
+
+ protected void updateView(Map<String, String> attributes) {
+
+ this.styleAttributes = attributes;
+ this.currentStyle = getStyle(attributes);
+ updateBrowser();
+
+ }
}
15 years, 4 months