JBoss Tools SVN: r23538 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-07-19 10:05:44 -0400 (Mon, 19 Jul 2010)
New Revision: 23538
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
Log:
https://jira.jboss.org/browse/JBIDE-4858
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java 2010-07-19 11:41:50 UTC (rev 23537)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java 2010-07-19 14:05:44 UTC (rev 23538)
@@ -10,24 +10,15 @@
******************************************************************************/
package org.jboss.tools.jsf.ui.el.refactoring;
-import java.io.IOException;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
-import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -39,43 +30,23 @@
import org.eclipse.ui.menus.IContributionRoot;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.services.IServiceLocator;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.model.ELExpression;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolution;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ELSegment;
-import org.jboss.tools.common.el.core.resolver.ELSegmentImpl;
-import org.jboss.tools.common.el.core.resolver.JavaMemberELSegmentImpl;
+import org.jboss.tools.common.el.core.resolver.JavaMemberELSegment;
import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
import org.jboss.tools.common.propertieseditor.PropertiesCompoundEditor;
-import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.el.refactoring.RenameELVariableProcessor;
import org.jboss.tools.jsf.el.refactoring.RenameMessagePropertyProcessor;
import org.jboss.tools.jsf.ui.JsfUIMessages;
import org.jboss.tools.jsf.ui.JsfUiPlugin;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.ui.editors.WebCompoundEditor;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author Daniel Azarov
@@ -87,13 +58,10 @@
private static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
private static final String JSP_EXT = "jsp"; //$NON-NLS-1$
private static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
- private static final String GET = "get"; //$NON-NLS-1$
- private static final String SET = "set"; //$NON-NLS-1$
- private static final String IS = "is"; //$NON-NLS-1$
- static private String selectedText;
+ //static private String selectedText;
static private IFile editorFile;
- private String fileContent;
+ //private String fileContent;
private IEditorPart editor;
private Shell shell;
@@ -155,35 +123,20 @@
if(sel instanceof TextSelection){
TextSelection selection = (TextSelection)sel;
- selectedText = selection.getText();
+ ELSegment segment = findELSegment(editorFile, selection);
+ if(segment == null)
+ return;
+ if(segment instanceof MessagePropertyELSegment){
+ mm.add(new RenameMessagePropertyAction((MessagePropertyELSegment)segment));
- try {
- fileContent = FileUtil.readStream(editorFile);
- } catch (CoreException e) {
- JsfUiPlugin.getDefault().logError(e);
- }
-
- boolean status = false;
-
- if(JAVA_EXT.equalsIgnoreCase(ext)){
- status = checkContextVariableInJava(editorFile, fileContent, selection);
- } else if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
- status = checkContextVariableInDOM(editorFile, fileContent, selection);
- else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
- status = checkContextVariableInProperties(editorFile, fileContent, selection);
-
- MessagePropertyELSegment messageSegment = checkMessageProperty(editorFile, selection);
- if(messageSegment != null){
- mm.add(new RenameMessagePropertyAction(messageSegment));
-
if(!separatorIsAdded){
additions.addContributionItem(new Separator(), null);
separatorIsAdded = true;
}
}
- if(status){
- mm.add(new RenameELVariableAction());
+ if(segment instanceof JavaMemberELSegment){
+ mm.add(new RenameELVariableAction((JavaMemberELSegment)segment));
if(!separatorIsAdded){
additions.addContributionItem(new Separator(), null);
@@ -196,7 +149,8 @@
}
}
- private MessagePropertyELSegment checkMessageProperty(IFile file, TextSelection selection){
+
+ private ELSegment findELSegment(IFile file, TextSelection selection){
ELContext context = PageContextFactory.createPageContext(file);
if(context == null)
@@ -222,11 +176,10 @@
if(!segment.isResolved())
continue;
- if(segment instanceof MessagePropertyELSegment &&
- selection.getOffset() <= reference.getStartPosition()+segment.getSourceReference().getStartPosition() &&
+ if(selection.getOffset() <= reference.getStartPosition()+segment.getSourceReference().getStartPosition() &&
selection.getOffset()+selection.getLength() >= reference.getStartPosition()+segment.getSourceReference().getStartPosition()+segment.getSourceReference().getLength()){
- MessagePropertyELSegment messageSegment = (MessagePropertyELSegment)segment;
- return messageSegment;
+ if(segment instanceof MessagePropertyELSegment || segment instanceof JavaMemberELSegment)
+ return segment;
}
}
@@ -236,138 +189,6 @@
return null;
}
- private boolean checkContextVariableInJava(IFile file, String content, TextSelection selection){
- try {
- FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
- Document document = new Document(content);
- scaner.setRange(document, 0, document.getLength());
- IToken token = scaner.nextToken();
- while(token!=null && token!=Token.EOF) {
- if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
- int length = scaner.getTokenLength();
- int offset = scaner.getTokenOffset();
- if(offset <= selection.getOffset() && (offset+length) >= (selection.getOffset()+selection.getLength())){
- String value = document.get(offset, length);
- if(value.indexOf('{')>-1) {
- return scanString(file, value, offset, selection);
- }
- }
- }
- token = scaner.nextToken();
- }
- } catch (BadLocationException e) {
- JsfUiPlugin.getDefault().logError(e);
- }
- return false;
- }
-
- private boolean scanString(IFile file, String string, int offset, TextSelection selection) {
- int startEl = string.indexOf("#{"); //$NON-NLS-1$
- if(startEl>-1) {
- ELParser parser = ELParserUtil.getJbossFactory().createParser();
- ELModel model = parser.parse(string);
- for (ELInstance instance : model.getInstances()) {
- for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
- ELPropertyInvocation pi = findELVariable(ie);
- if(pi != null){
- if(offset+pi.getStartPosition() == selection.getOffset() && pi.getLength() == selection.getLength()){
- String beanName = RenameELVariableProcessor.getManagedBeanName(file, pi.getText());
- if(beanName != null){
- selectedText = beanName;
- return true;
- }
- }
- }
- }
- }
- }
- return false;
- }
-
- private ELPropertyInvocation findELVariable(ELInvocationExpression invocationExpression){
- ELInvocationExpression invExp = invocationExpression;
- while(invExp != null){
- if(invExp instanceof ELPropertyInvocation){
- if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(selectedText))
- return (ELPropertyInvocation)invExp;
- else
- invExp = invExp.getLeft();
-
- }else{
- invExp = invExp.getLeft();
- }
- }
- return null;
- }
-
- private boolean checkContextVariableInDOM(IFile file, String content, TextSelection selection){
- IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- return false;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- return scanChildNodes(file, document, selection);
- }
- } catch (CoreException e) {
- JsfUiPlugin.getDefault().logError(e);
- } catch (IOException e) {
- JsfUiPlugin.getDefault().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return false;
- }
-
- private boolean scanChildNodes(IFile file, Node parent, TextSelection selection) {
- boolean status = false;
- NodeList children = parent.getChildNodes();
- for(int i=0; i<children.getLength(); i++) {
- Node curentValidatedNode = children.item(i);
- if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
- status = scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE, selection);
- if(status)
- return status;
- } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
- status = scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT, selection);
- if(status)
- return status;
- }
- status = scanChildNodes(file, curentValidatedNode, selection);
- if(status)
- return status;
- }
- return false;
- }
-
- private boolean scanNodeContent(IFile file, IStructuredDocumentRegion node, String regionType, TextSelection selection) {
- boolean status = false;
- ITextRegionList regions = node.getRegions();
- for(int i=0; i<regions.size(); i++) {
- ITextRegion region = regions.get(i);
- if(region.getType() == regionType) {
- String text = node.getFullText(region);
- if(text.indexOf("{")>-1) { //$NON-NLS-1$
- int offset = node.getStartOffset() + region.getStart();
- status = scanString(file, text, offset, selection);
- if(status)
- return status;
- }
- }
- }
- return false;
- }
-
- private boolean checkContextVariableInProperties(IFile file, String content, TextSelection selection){
- return scanString(file, content, 0, selection);
- }
-
private static void saveAndBuild(){
if(!JsfUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().saveAllEditors(true))
return;
@@ -382,7 +203,7 @@
public static void invokeRenameELVariableWizard(String oldName, Shell activeShell) {
saveAndBuild();
- RenameELVariableProcessor processor = new RenameELVariableProcessor(editorFile, selectedText);
+ RenameELVariableProcessor processor = new RenameELVariableProcessor(editorFile, oldName);
RenameRefactoring refactoring = new RenameRefactoring(processor);
RenameELVariableWizard wizard = new RenameELVariableWizard(refactoring, editorFile);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
@@ -410,13 +231,15 @@
}
class RenameELVariableAction extends Action{
- public RenameELVariableAction(){
+ JavaMemberELSegment segment;
+ public RenameELVariableAction(JavaMemberELSegment segment){
super(JsfUIMessages.REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE);
+ this.segment = segment;
}
public void run(){
saveAndBuild();
- invokeRenameELVariableWizard(selectedText, shell);
+ invokeRenameELVariableWizard(segment.getToken().getText(), shell);
}
}
15 years, 9 months
JBoss Tools SVN: r23537 - branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-19 07:41:50 -0400 (Mon, 19 Jul 2010)
New Revision: 23537
Modified:
branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
JBIDE-6596 - patch to M1 branch to avoid NPE
Modified: branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-07-19 11:34:10 UTC (rev 23536)
+++ branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-07-19 11:41:50 UTC (rev 23537)
@@ -22,7 +22,6 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.server.core.IJ2EEModule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
@@ -40,6 +39,7 @@
import org.jboss.ide.eclipse.as.core.util.FileUtil.FileUtilListener;
import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
/**
* This class provides a default implementation for packaging different types of
@@ -108,21 +108,21 @@
IModuleResource[] members = getResources(module);
ArrayList<IStatus> list = new ArrayList<IStatus>();
- IJ2EEModule j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
+ boolean isBinary = ServerModelUtilities.isBinaryModule(module);
boolean delete = true;
- if (j2eeModule != null && j2eeModule.isBinary()) {
+ if (isBinary) {
delete = false;
}
// if the module we're publishing is a project, not a binary, clean it's folder
if( !(new Path(module.getName()).segmentCount() > 1 ) && delete)
list.addAll(Arrays.asList(localSafeDelete(deployPath)));
- if( !deployPackaged(moduleTree) && !j2eeModule.isBinary()) {
+ if( !deployPackaged(moduleTree) && !isBinary) {
LocalCopyCallback handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
PublishCopyUtil util = new PublishCopyUtil(handler);
list.addAll(Arrays.asList(util.publishFull(members, monitor)));
}
- else if(j2eeModule.isBinary())
+ else if(isBinary)
list.addAll(Arrays.asList(copyBinaryModule(moduleTree)));
else
list.addAll(Arrays.asList(packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath)));
@@ -152,13 +152,13 @@
IStatus[] results = new IStatus[] {};
IPath deployPath = getDeployPath(moduleTree, server);
IPath tempDeployPath = getTempDeployFolder(moduleTree, server);
- IJ2EEModule j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
+ boolean isBinary = ServerModelUtilities.isBinaryModule(module);
LocalCopyCallback handler = null;
- if( !deployPackaged(moduleTree) && !j2eeModule.isBinary()) {
+ if( !deployPackaged(moduleTree) && !isBinary) {
handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
} else if( delta.length > 0 ) {
- if( j2eeModule.isBinary())
+ if( isBinary)
results = copyBinaryModule(moduleTree);
else
results = packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath);
Modified: branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-19 11:34:10 UTC (rev 23536)
+++ branches/jbosstools-3.2.0.M1/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-19 11:41:50 UTC (rev 23537)
@@ -43,6 +43,7 @@
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentTypePrefs;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.IWTPConstants;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
public class PublishUtil {
public static int countChanges(IModuleResourceDelta[] deltas) {
@@ -192,10 +193,10 @@
return suffix;
}
- // TODO This can also change to find the isBinaryModule method
+ @Deprecated
public static boolean isBinaryObject(IModule[] moduleTree) {
- IJ2EEModule j2eeModule = (IJ2EEModule) moduleTree[moduleTree.length-1].loadAdapter(IJ2EEModule.class, null);
- return j2eeModule != null && j2eeModule.isBinary();
+ IModule lastModule = moduleTree[moduleTree.length-1];
+ return ServerModelUtilities.isBinaryModule(lastModule);
}
15 years, 9 months
JBoss Tools SVN: r23536 - in trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test: publishing/v2 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-19 07:34:10 -0400 (Mon, 19 Jul 2010)
New Revision: 23536
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
Log:
JBIDE-6596 - trunk test case
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2010-07-19 11:21:23 UTC (rev 23535)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2010-07-19 11:34:10 UTC (rev 23536)
@@ -32,6 +32,7 @@
import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512aTest;
import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512bTest;
import org.jboss.ide.eclipse.as.test.publishing.JBIDE4184Test;
+import org.jboss.ide.eclipse.as.test.publishing.v2.JSTDeployBinaryChildModuleTest;
import org.jboss.ide.eclipse.as.test.publishing.v2.JSTDeploymentTester;
import org.jboss.ide.eclipse.as.test.publishing.v2.SingleFileDeploymentTester;
@@ -48,6 +49,7 @@
suite.addTestSuite(JBIDE4184Test.class);
suite.addTestSuite(TestEar5WithJBossRuntime.class);
suite.addTestSuite(JSTDeploymentTester.class);
+ suite.addTestSuite(JSTDeployBinaryChildModuleTest.class);
suite.addTestSuite(SingleFileDeploymentTester.class);
return suite;
}
Added: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java 2010-07-19 11:34:10 UTC (rev 23536)
@@ -0,0 +1,49 @@
+package org.jboss.ide.eclipse.as.test.publishing.v2;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.test.publishing.AbstractDeploymentTest;
+import org.jboss.ide.eclipse.as.test.util.wtp.JavaEEFacetConstants;
+import org.jboss.ide.eclipse.as.test.util.wtp.OperationTestCase;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectCreationUtil;
+
+public class JSTDeployBinaryChildModuleTest extends JSTDeploymentTester {
+ protected IProject createProject() throws Exception {
+ IDataModel dm = ProjectCreationUtil.getWebDataModel(MODULE_NAME, null, null, null, null, JavaEEFacetConstants.WEB_24, false);
+ OperationTestCase.runAndVerify(dm);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(MODULE_NAME);
+ assertTrue(p.exists());
+ File srcFile = AbstractDeploymentTest.getFileLocation("projectPieces/EJB3NoDescriptor.jar");
+ String proj = p.getLocation().toOSString();
+ p.getFolder("WebContent").getFolder("WEB-INF")
+ .getFolder("lib").getFile("test.jar").create(
+ new FileInputStream(srcFile), true, new NullProgressMonitor());
+ p.refreshLocal(0, new NullProgressMonitor());
+ return p;
+ }
+
+ public void testMain() throws CoreException, IOException {
+ IModule mod = ServerUtil.getModule(project);
+ IModule[] module = new IModule[] { mod };
+ verifyJSTPublisher(module);
+ addModule(mod);
+ publish();
+ IPath deployRoot = new Path(getDeployRoot(server));
+ IPath rootFolder = deployRoot.append(MODULE_NAME + ".war");
+ assertTrue(rootFolder.toFile().exists());
+ IPath webinf_lib_testjar = rootFolder.append("WEB-INF").append("lib").append("test.jar");
+ assertTrue("test.jar exists in deployment", webinf_lib_testjar.toFile().exists());
+ assertTrue("test.jar File is actually a file", webinf_lib_testjar.toFile().isFile());
+ }
+}
15 years, 9 months
JBoss Tools SVN: r23535 - in branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test: publishing/v2 and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-19 07:21:23 -0400 (Mon, 19 Jul 2010)
New Revision: 23535
Added:
branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java
Modified:
branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
Log:
Testcase for JBIDE-6596
Modified: branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
--- branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2010-07-19 10:34:32 UTC (rev 23534)
+++ branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2010-07-19 11:21:23 UTC (rev 23535)
@@ -32,6 +32,7 @@
import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512aTest;
import org.jboss.ide.eclipse.as.test.publishing.JBIDE2512bTest;
import org.jboss.ide.eclipse.as.test.publishing.JBIDE4184Test;
+import org.jboss.ide.eclipse.as.test.publishing.v2.JSTDeployBinaryChildModuleTest;
import org.jboss.ide.eclipse.as.test.publishing.v2.JSTDeploymentTester;
import org.jboss.ide.eclipse.as.test.publishing.v2.SingleFileDeploymentTester;
@@ -48,6 +49,7 @@
suite.addTestSuite(JBIDE4184Test.class);
suite.addTestSuite(TestEar5WithJBossRuntime.class);
suite.addTestSuite(JSTDeploymentTester.class);
+ suite.addTestSuite(JSTDeployBinaryChildModuleTest.class);
suite.addTestSuite(SingleFileDeploymentTester.class);
return suite;
}
Added: branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java
===================================================================
--- branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java (rev 0)
+++ branches/jbosstools-3.2.0.M1/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/publishing/v2/JSTDeployBinaryChildModuleTest.java 2010-07-19 11:21:23 UTC (rev 23535)
@@ -0,0 +1,49 @@
+package org.jboss.ide.eclipse.as.test.publishing.v2;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.test.publishing.AbstractDeploymentTest;
+import org.jboss.ide.eclipse.as.test.util.wtp.JavaEEFacetConstants;
+import org.jboss.ide.eclipse.as.test.util.wtp.OperationTestCase;
+import org.jboss.ide.eclipse.as.test.util.wtp.ProjectCreationUtil;
+
+public class JSTDeployBinaryChildModuleTest extends JSTDeploymentTester {
+ protected IProject createProject() throws Exception {
+ IDataModel dm = ProjectCreationUtil.getWebDataModel(MODULE_NAME, null, null, null, null, JavaEEFacetConstants.WEB_24, false);
+ OperationTestCase.runAndVerify(dm);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(MODULE_NAME);
+ assertTrue(p.exists());
+ File srcFile = AbstractDeploymentTest.getFileLocation("projectPieces/EJB3NoDescriptor.jar");
+ String proj = p.getLocation().toOSString();
+ p.getFolder("WebContent").getFolder("WEB-INF")
+ .getFolder("lib").getFile("test.jar").create(
+ new FileInputStream(srcFile), true, new NullProgressMonitor());
+ p.refreshLocal(0, new NullProgressMonitor());
+ return p;
+ }
+
+ public void testMain() throws CoreException, IOException {
+ IModule mod = ServerUtil.getModule(project);
+ IModule[] module = new IModule[] { mod };
+ verifyJSTPublisher(module);
+ addModule(mod);
+ publish();
+ IPath deployRoot = new Path(getDeployRoot(server));
+ IPath rootFolder = deployRoot.append(MODULE_NAME + ".war");
+ assertTrue(rootFolder.toFile().exists());
+ IPath webinf_lib_testjar = rootFolder.append("WEB-INF").append("lib").append("test.jar");
+ assertTrue("test.jar exists in deployment", webinf_lib_testjar.toFile().exists());
+ assertTrue("test.jar File is actually a file", webinf_lib_testjar.toFile().isFile());
+ }
+}
15 years, 9 months
JBoss Tools SVN: r23534 - in branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl: src/org/jbpm/gd/jpdl/deployment and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2010-07-19 06:34:32 -0400 (Mon, 19 Jul 2010)
New Revision: 23534
Added:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
Modified:
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
Log:
GPD-398
Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-07-19 10:24:32 UTC (rev 23533)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-07-19 10:34:32 UTC (rev 23534)
@@ -1578,4 +1578,9 @@
<startup class="org.jbpm.gd.jpdl.StartupClass"/>
</extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jbpm.gd.jpdl.prefs.Initializer"/>
+ </extension>
+
</plugin>
Modified: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-07-19 10:24:32 UTC (rev 23533)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-07-19 10:34:32 UTC (rev 23534)
@@ -50,6 +50,9 @@
}
public String getServerName() {
+ if (serverName == null) {
+ serverName = getPrefs().getString(SERVER_NAME);
+ }
return serverName;
}
@@ -58,6 +61,9 @@
}
public String getServerPort() {
+ if (serverPort == null) {
+ serverPort = getPrefs().getString(SERVER_PORT);
+ }
return serverPort;
}
@@ -66,6 +72,9 @@
}
public String getServerDeployer() {
+ if (serverDeployer == null) {
+ serverDeployer = getPrefs().getString(SERVER_DEPLOYER);
+ }
return serverDeployer;
}
Added: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
===================================================================
--- branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java (rev 0)
+++ branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java 2010-07-19 10:34:32 UTC (rev 23534)
@@ -0,0 +1,20 @@
+package org.jbpm.gd.jpdl.prefs;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jbpm.gd.jpdl.Plugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class Initializer extends AbstractPreferenceInitializer implements PreferencesConstants {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore preferenceStore = Plugin.getDefault().getPreferenceStore();
+ preferenceStore.setValue(SERVER_NAME, "localhost");
+ preferenceStore.setValue(SERVER_PORT, "8080");
+ preferenceStore.setValue(SERVER_DEPLOYER, "/jbpm-console/upload");
+ preferenceStore.setValue(USE_CREDENTIALS, false);
+ preferenceStore.setValue(USER_NAME, "user name");
+ preferenceStore.setValue(PASSWORD, "password");
+ }
+
+}
Property changes on: branches/jbosstools-3.1.x/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
JBoss Tools SVN: r23533 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-07-19 06:24:32 -0400 (Mon, 19 Jul 2010)
New Revision: 23533
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
JBIDE-6596 cleanup avoid NPEs
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-07-19 09:56:03 UTC (rev 23532)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-07-19 10:24:32 UTC (rev 23533)
@@ -22,7 +22,6 @@
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jst.server.core.IJ2EEModule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
@@ -40,6 +39,7 @@
import org.jboss.ide.eclipse.as.core.util.FileUtil.FileUtilListener;
import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
/**
* This class provides a default implementation for packaging different types of
@@ -108,21 +108,21 @@
IModuleResource[] members = getResources(module);
ArrayList<IStatus> list = new ArrayList<IStatus>();
- IJ2EEModule j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
+ boolean isBinary = ServerModelUtilities.isBinaryModule(module);
boolean delete = true;
- if (j2eeModule != null && j2eeModule.isBinary()) {
+ if (isBinary) {
delete = false;
}
// if the module we're publishing is a project, not a binary, clean it's folder
if( !(new Path(module.getName()).segmentCount() > 1 ) && delete)
list.addAll(Arrays.asList(localSafeDelete(deployPath)));
- if( !deployPackaged(moduleTree) && !j2eeModule.isBinary()) {
+ if( !deployPackaged(moduleTree) && !isBinary) {
LocalCopyCallback handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
PublishCopyUtil util = new PublishCopyUtil(handler);
list.addAll(Arrays.asList(util.publishFull(members, monitor)));
}
- else if(j2eeModule.isBinary())
+ else if(isBinary)
list.addAll(Arrays.asList(copyBinaryModule(moduleTree)));
else
list.addAll(Arrays.asList(packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath)));
@@ -152,13 +152,13 @@
IStatus[] results = new IStatus[] {};
IPath deployPath = getDeployPath(moduleTree, server);
IPath tempDeployPath = getTempDeployFolder(moduleTree, server);
- IJ2EEModule j2eeModule = (IJ2EEModule) module.loadAdapter(IJ2EEModule.class, null);
+ boolean isBinary = ServerModelUtilities.isBinaryModule(module);
LocalCopyCallback handler = null;
- if( !deployPackaged(moduleTree) && !j2eeModule.isBinary()) {
+ if( !deployPackaged(moduleTree) && !isBinary) {
handler = new LocalCopyCallback(server.getServer(), deployPath, tempDeployPath);
results = new PublishCopyUtil(handler).publishDelta(delta, monitor);
} else if( delta.length > 0 ) {
- if( j2eeModule.isBinary())
+ if( isBinary)
results = copyBinaryModule(moduleTree);
else
results = packModuleIntoJar(moduleTree[moduleTree.length-1], deployPath);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-19 09:56:03 UTC (rev 23532)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-07-19 10:24:32 UTC (rev 23533)
@@ -43,6 +43,7 @@
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentTypePrefs;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.IWTPConstants;
+import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
public class PublishUtil {
public static int countChanges(IModuleResourceDelta[] deltas) {
@@ -192,10 +193,10 @@
return suffix;
}
- // TODO This can also change to find the isBinaryModule method
+ @Deprecated
public static boolean isBinaryObject(IModule[] moduleTree) {
- IJ2EEModule j2eeModule = (IJ2EEModule) moduleTree[moduleTree.length-1].loadAdapter(IJ2EEModule.class, null);
- return j2eeModule != null && j2eeModule.isBinary();
+ IModule lastMod = moduleTree[moduleTree.length-1];
+ return ServerModelUtilities.isBinaryModule(lastMod);
}
public static IModuleResource[] getResources(IModule module) throws CoreException {
15 years, 9 months
JBoss Tools SVN: r23532 - in trunk/jbpm/plugins/org.jbpm.gd.jpdl: src/org/jbpm/gd/jpdl/deployment and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2010-07-19 05:56:03 -0400 (Mon, 19 Jul 2010)
New Revision: 23532
Added:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
Log:
GPD-398
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-07-19 09:38:05 UTC (rev 23531)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2010-07-19 09:56:03 UTC (rev 23532)
@@ -1576,6 +1576,10 @@
<extension point="org.eclipse.ui.startup">
<startup class="org.jbpm.gd.jpdl.StartupClass"/>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jbpm.gd.jpdl.prefs.Initializer"/>
</extension>
</plugin>
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-07-19 09:38:05 UTC (rev 23531)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentInfo.java 2010-07-19 09:56:03 UTC (rev 23532)
@@ -50,6 +50,9 @@
}
public String getServerName() {
+ if (serverName == null) {
+ serverName = getPrefs().getString(SERVER_NAME);
+ }
return serverName;
}
@@ -58,6 +61,9 @@
}
public String getServerPort() {
+ if (serverPort == null) {
+ serverPort = getPrefs().getString(SERVER_PORT);
+ }
return serverPort;
}
@@ -66,6 +72,9 @@
}
public String getServerDeployer() {
+ if (serverDeployer == null) {
+ serverDeployer = getPrefs().getString(SERVER_DEPLOYER);
+ }
return serverDeployer;
}
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java 2010-07-19 09:56:03 UTC (rev 23532)
@@ -0,0 +1,20 @@
+package org.jbpm.gd.jpdl.prefs;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jbpm.gd.jpdl.Plugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class Initializer extends AbstractPreferenceInitializer implements PreferencesConstants {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore preferenceStore = Plugin.getDefault().getPreferenceStore();
+ preferenceStore.setValue(SERVER_NAME, "localhost");
+ preferenceStore.setValue(SERVER_PORT, "8080");
+ preferenceStore.setValue(SERVER_DEPLOYER, "/jbpm-console/upload");
+ preferenceStore.setValue(USE_CREDENTIALS, false);
+ preferenceStore.setValue(USER_NAME, "user name");
+ preferenceStore.setValue(PASSWORD, "password");
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/Initializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
JBoss Tools SVN: r23531 - trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-07-19 05:38:05 -0400 (Mon, 19 Jul 2010)
New Revision: 23531
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
Log:
https://jira.jboss.org/browse/JBIDE-6333 :
Add text caption for resizer actions
- Label showing new size 'W x H' is added.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java 2010-07-19 09:16:52 UTC (rev 23530)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerConstants.java 2010-07-19 09:38:05 UTC (rev 23531)
@@ -78,7 +78,6 @@
/** VPE_CLASS_NAME_MOZ_RESIZING_SHADOW */
public static final String VPE_CLASS_NAME_MOZ_RESIZING_SHADOW = "mozResizingShadow"; //$NON-NLS-1$
-
-
-
+
+ public static final String VPE_CLASS_NAME_MOZ_RESIZING_INFO = "mozResizingInfo"; //$NON-NLS-1$
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java 2010-07-19 09:16:52 UTC (rev 23530)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java 2010-07-19 09:38:05 UTC (rev 23531)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.jboss.tools.vpe.xulrunner.util.XulRunnerVpeUtils;
import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
@@ -33,10 +34,13 @@
* IXulRunnerVpeResizer implementation
* @author A. Yukhovich
*/
-public class XulRunnerVpeResizer implements IXulRunnerVpeResizer {
+public class XulRunnerVpeResizer implements IXulRunnerVpeResizer {
+
+ private static String RESIZING_INFO_FORMAT = "%s x %s"; //$NON-NLS-1$
+ private static Point RESIZING_INFO_OFFSET = new Point(20, 20);
+
/** COEFFICIENT_TYPE */
enum COEFFICIENT_TYPE { X, Y, WIDTH, HEIGHT };
-
/** RESIZER_MARKER_STRING_TOPLEFT */
final static private String RESIZER_MARKER_STRING_TOPLEFT = "nw"; //$NON-NLS-1$
@@ -91,6 +95,8 @@
/** resizingShadow */
private nsIDOMElement resizingShadow;
+ private nsIDOMElement resizingInfo;
+
/** domDocument */
private nsIDOMDocument domDocument;
@@ -145,7 +151,7 @@
if ( resizingObject != null ) {
hide();
}
-
+
resizingObject = domElement;
elementBounds = XulRunnerVpeUtils.getElementBounds(domElement);
@@ -217,9 +223,10 @@
setAllResizersPosition();
- resizingShadow = createShadow(bodyElement, resizingObject);
-
- setShadowPosition(resizingShadow, elementBounds.x, elementBounds.y);
+ resizingShadow = createShadow(bodyElement);
+ setElementPosition(resizingShadow, elementBounds.x, elementBounds.y);
+
+ resizingInfo = createResizingInfo(bodyElement);
}
@@ -276,8 +283,14 @@
if ( resizingShadow != null ) {
parentNode.removeChild(resizingShadow);
+ resizingShadow = null;
}
+ if (resizingInfo != null) {
+ parentNode.removeChild(resizingInfo);
+ resizingInfo = null;
+ }
+
markerBottom = null;
markerTop = null;
markerLeft = null;
@@ -287,7 +300,6 @@
markerTopRight = null;
markerTopLeft = null;
- resizingShadow = null;
resizingObject = null;
}
@@ -333,14 +345,65 @@
int newWidth = getNewResizingWidth(clientX, clientY);
int newHeight = getNewResizingHeight(clientX, clientY);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_LEFT, newX);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_TOP, newY);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, newWidth);
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT, newHeight);
- } // if
+ Rectangle shadowBounds = new Rectangle(newX, newY, newWidth, newHeight);
+
+ setElementBounds(resizingShadow, shadowBounds);
+ redrawResizingInfo(shadowBounds);
+ }
}
+
+ private void redrawResizingInfo(Rectangle bounds) {
+ while (resizingInfo.hasChildNodes()) {
+ resizingInfo.removeChild(resizingInfo.getLastChild());
+ }
+ resizingInfo.appendChild(domDocument.createTextNode(
+ String.format(RESIZING_INFO_FORMAT, bounds.width, bounds.height)));
+
+ Point position;
+ switch (usedResizeMarker) {
+ case RESIZER_MARKER_TOPLEFT:
+ position = new Point(bounds.x, bounds.y);
+ break;
+ case RESIZER_MARKER_TOP:
+ position = new Point(bounds.x + bounds.width / 2,
+ bounds.y);
+ break;
+ case RESIZER_MARKER_TOPRIGHT:
+ position = new Point(bounds.x + bounds.width,
+ bounds.y);
+ break;
+ case RESIZER_MARKER_LEFT:
+ position = new Point(bounds.x,
+ bounds.y + bounds.height / 2);
+ break;
+ case RESIZER_MARKER_RIGHT:
+ position = new Point(bounds.x + bounds.width,
+ bounds.y + bounds.height / 2);
+ break;
+ case RESIZER_MARKER_BOTTOMLEFT:
+ position = new Point(bounds.x,
+ bounds.y + bounds.height);
+ break;
+ case RESIZER_MARKER_BOTTOM:
+ position = new Point(bounds.x + bounds.width / 2,
+ bounds.y + bounds.height);
+ break;
+ case RESIZER_MARKER_BOTTOMRIGHT:
+ position = new Point(bounds.x + bounds.width,
+ bounds.y + bounds.height);
+ break;
+ default:
+ position = new Point(0, 0);
+ break;
+ }
+ position.x += RESIZING_INFO_OFFSET.x;
+ position.y += RESIZING_INFO_OFFSET.y;
+ setElementPosition(resizingInfo, position.x, position.y);
+ }
+
+
/* (non-Javadoc)
* @see org.jboss.vpe.mozilla.resizer.IVpeResizer#mouseUp(int, int, org.mozilla.interfaces.nsIDOMElement)
*/
@@ -348,8 +411,6 @@
if (isResizing) {
isResizing = false;
-
- hideShadow();
endResizing(aX, aY);
nsIDOMEventTarget erP = getDOMEventTarget();
@@ -388,17 +449,6 @@
}
/**
- * Setting a position of shadow
- * @param shadowElement
- * @param aOriginalObjectX
- * @param aOriginalObjectY
- */
- private void setShadowPosition(nsIDOMElement shadowElement, int aOriginalObjectX, int aOriginalObjectY) {
- setAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, shadowElement);
- }
-
-
- /**
* create a anonymous dom-element
*
* @param aTag
@@ -434,14 +484,18 @@
* @param originalObject
* @return
*/
- private nsIDOMElement createShadow(nsIDOMNode parentNode, nsIDOMElement originalObject) {
- nsIDOMElement returnElement = null;
-
- returnElement = createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN, parentNode, XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_SHADOW, true );
-
- return returnElement;
+ private nsIDOMElement createShadow(nsIDOMNode parentNode) {
+ return createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN,
+ parentNode, XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_SHADOW,
+ true);
}
+ private nsIDOMElement createResizingInfo(nsIDOMNode parentNode) {
+ return createAnonymousElement(XulRunnerConstants.HTML_TAG_SPAN,
+ parentNode, XulRunnerConstants.VPE_CLASS_NAME_MOZ_RESIZING_INFO,
+ true);
+ }
+
/**
*
* @param domElement
@@ -486,14 +540,13 @@
// make the shadow appear
resizingShadow.removeAttribute(XulRunnerConstants.HTML_ATTR_CLASS);
-
// position it
- setShadowPosition(resizingShadow, elementBounds.x, elementBounds.y);
-
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_WIDTH, elementBounds.width );
- setStylePropertyPixels(resizingShadow, XulRunnerConstants.HTML_ATTR_HEIGHT, elementBounds.height );
+ setElementBounds(resizingShadow, elementBounds);
+ resizingInfo.removeAttribute(XulRunnerConstants.HTML_ATTR_CLASS);
+ redrawResizingInfo(elementBounds);
+
if (mouseMotionListener != null) {
return;
}
@@ -655,50 +708,55 @@
int rh = (int)((resizerHeight+ 1) / 2);
if (markerTopLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top-resizerHeight-2, markerTopLeft);
+ setElementPosition(markerTopLeft, left-resizerWidth-2, top-resizerHeight-2);
}
if (markerTop != null) {
- setAnonymousElementPosition(left+width/2-rw, top-resizerHeight-2, markerTop);
+ setElementPosition(markerTop, left+width/2-rw, top-resizerHeight-2);
}
if (markerTopRight != null) {
- setAnonymousElementPosition(left+width, top-resizerHeight-2, markerTopRight);
+ setElementPosition(markerTopRight, left+width, top-resizerHeight-2);
}
if (markerLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top+height/2-rh, markerLeft);
+ setElementPosition(markerLeft, left-resizerWidth-2, top+height/2-rh);
}
if (markerRight != null) {
- setAnonymousElementPosition(left+width, top+height/2-rh, markerRight);
+ setElementPosition(markerRight, left+width, top+height/2-rh);
}
if (markerBottomLeft != null) {
- setAnonymousElementPosition(left-resizerWidth-2, top+height, markerBottomLeft);
+ setElementPosition(markerBottomLeft, left-resizerWidth-2, top+height);
}
if (markerBottom != null) {
- setAnonymousElementPosition(left+width/2-rw, top+height, markerBottom);
+ setElementPosition(markerBottom, left+width/2-rw, top+height);
}
if (markerBottomRight != null) {
- setAnonymousElementPosition(left+width, top+height, markerBottomRight);
+ setElementPosition(markerBottomRight, left+width, top+height);
}
}
-
- /**
- *
- * @param left
- * @param top
- * @param domElement
- */
- private void setAnonymousElementPosition(int left, int top,nsIDOMElement domElement) {
+
+ private void setElementPosition(nsIDOMElement domElement, int left,int top) {
setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_LEFT, left);
setStylePropertyPixels(domElement,XulRunnerConstants.HTML_ATTR_TOP, top);
}
+ private void setElementSize(nsIDOMElement domElement, int width,int height) {
+ setStylePropertyPixels(domElement, XulRunnerConstants.HTML_ATTR_WIDTH, width);
+ setStylePropertyPixels(domElement, XulRunnerConstants.HTML_ATTR_HEIGHT, height);
+ }
+
+ private void setElementBounds(nsIDOMElement domElement, Rectangle bounds) {
+ setElementPosition(domElement, bounds.x, bounds.y);
+ setElementSize(domElement, bounds.width, bounds.height);
+ }
+
+
/**
*
* @param aElement
@@ -765,6 +823,11 @@
if (resizingShadow == null) {
return;
}
+ resizingShadow.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS, XulRunnerConstants.HTML_VALUE_HIDDEN);
+ if (resizingInfo == null) {
+ return;
+ }
+ resizingInfo.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS, XulRunnerConstants.HTML_VALUE_HIDDEN);
if( activeHandle != null) {
activeHandle.removeAttribute(XulRunnerConstants.STRING_MOZ_ACTIVATED);
@@ -785,15 +848,6 @@
usedResizeMarker = 0;
}
- /**
- * Hide of shadow box
- */
- private void hideShadow() {
- if (resizingShadow != null ) {
- resizingShadow.setAttribute(XulRunnerConstants.HTML_ATTR_CLASS, XulRunnerConstants.HTML_VALUE_HIDDEN);
- }
- }
-
public void dispose() {
if (mouseMotionListener != null) {
nsIDOMEventTarget erP = getDOMEventTarget();
15 years, 9 months
JBoss Tools SVN: r23530 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-07-19 05:16:52 -0400 (Mon, 19 Jul 2010)
New Revision: 23530
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
Log:
https://jira.jboss.org/browse/JBIDE-6621
new Ingres dialects added to ui
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2010-07-19 08:46:20 UTC (rev 23529)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2010-07-19 09:16:52 UTC (rev 23530)
@@ -53,6 +53,8 @@
dialectNames.put("H2", "org.hibernate.dialect.H2Dialect"); //$NON-NLS-1$ //$NON-NLS-2$
dialectNames.put("Informix", "org.hibernate.dialect.InformixDialect"); //$NON-NLS-1$ //$NON-NLS-2$
dialectNames.put("Ingres", "org.hibernate.dialect.IngresDialect"); //$NON-NLS-1$ //$NON-NLS-2$
+ dialectNames.put("Ingres9", "org.hibernate.dialect.Ingres9Dialect"); //$NON-NLS-1$ //$NON-NLS-2$
+ dialectNames.put("Ingres10", "org.hibernate.dialect.Ingres10Dialect"); //$NON-NLS-1$ //$NON-NLS-2$
dialectNames.put("Interbase", "org.hibernate.dialect.InterbaseDialect"); //$NON-NLS-1$ //$NON-NLS-2$
dialectNames.put("Firebird", "org.hibernate.dialect.FirebirdDialect"); //$NON-NLS-1$ //$NON-NLS-2$
dialectNames.put("Mckoi SQL", "org.hibernate.dialect.MckoiDialect"); //$NON-NLS-1$ //$NON-NLS-2$
15 years, 9 months
JBoss Tools SVN: r23529 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-07-19 04:46:20 -0400 (Mon, 19 Jul 2010)
New Revision: 23529
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
Log:
https://jira.jboss.org/browse/JBIDE-6621
Fixed NPE for null dialect
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2010-07-19 08:24:56 UTC (rev 23528)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/DriverClassHelpers.java 2010-07-19 08:46:20 UTC (rev 23529)
@@ -29,7 +29,6 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import java.util.TreeMap;
/**
@@ -38,8 +37,8 @@
public class DriverClassHelpers {
private Map<String, String> dialectNames = new HashMap<String, String>();
- private Map<String, Set<String>> connectionUrls = new TreeMap<String, Set<String>>();
- private Map<String, Set<String>> driverClasses = new TreeMap<String, Set<String>>();
+ private Map<String, Set<String>> connectionUrls = new HashMap<String, Set<String>>();
+ private Map<String, Set<String>> driverClasses = new HashMap<String, Set<String>>();
private Map<String, String> driverToDialect = new HashMap<String, String>();
public DriverClassHelpers() {
15 years, 9 months