JBoss Tools SVN: r14643 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-09 11:36:02 -0400 (Thu, 09 Apr 2009)
New Revision: 14643
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/preferences/ClassTemplateComponent.java
Log:
JBIDE-4140
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/preferences/ClassTemplateComponent.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/preferences/ClassTemplateComponent.java 2009-04-09 15:31:03 UTC (rev 14642)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/templates/preferences/ClassTemplateComponent.java 2009-04-09 15:36:02 UTC (rev 14643)
@@ -20,7 +20,7 @@
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultTableStructuredAdapter;
import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
-import org.jboss.tools.common.model.ui.attribute.editor.JavaChoicerEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerEditor;
import org.jboss.tools.common.model.ui.attribute.editor.PropertyEditor;
import org.jboss.tools.common.model.ui.attribute.editor.StringButtonFieldEditorEx;
import org.jboss.tools.common.model.ui.attribute.editor.TableStructuredEditor;
@@ -44,7 +44,7 @@
Label xPathLabelValue;
String initValue = ""; //$NON-NLS-1$
// base class
- JavaChoicerEditor baseClassEditor;
+ JavaEclipseChoicerEditor baseClassEditor;
BaseClassAdapter baseClassAdapter;
BaseClassAdapterListener baseClassAdapterListener;
// interfaces
@@ -102,7 +102,7 @@
this.model = model;
// base class
- baseClassEditor = new JavaChoicerEditor();
+ baseClassEditor = new JavaEclipseChoicerEditor();
baseClassAdapter = new BaseClassAdapter();
baseClassAdapter.setModel(model);
baseClassAdapterListener = new BaseClassAdapterListener();
15 years, 8 months
JBoss Tools SVN: r14642 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-09 11:31:03 -0400 (Thu, 09 Apr 2009)
New Revision: 14642
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
Log:
JBIDE-4140
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java 2009-04-09 15:01:26 UTC (rev 14641)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java 2009-04-09 15:31:03 UTC (rev 14642)
@@ -102,8 +102,9 @@
FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(
shell,
false,
- ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(),
- SearchEngine.createJavaSearchScope(jp != null ? new IJavaElement[]{jp} : new IJavaElement[0]),
+ ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(),
+ jp == null ? SearchEngine.createWorkspaceScope()
+ : SearchEngine.createJavaSearchScope(new IJavaElement[]{jp}),
IJavaSearchConstants.TYPE);
dialog.setTitle(title);
IValueProvider valueProvider = (IValueProvider)adapter.getAdapter(IValueProvider.class);
15 years, 8 months
JBoss Tools SVN: r14641 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-04-09 11:01:26 -0400 (Thu, 09 Apr 2009)
New Revision: 14641
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077 added support different forms of annotations (@Name("name") or @Name(value="name"))
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 14:58:37 UTC (rev 14640)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 15:01:26 UTC (rev 14641)
@@ -364,7 +364,10 @@
CompositeChange root = new CompositeChange("Rename Seam Component");
TextFileChange change = new TextFileChange(file.getName(), file);
- TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), "@"+annotation.getElementName()+"(\""+newName+"\")");
+
+ String annotationText = annotation.getSource().replace(component.getName(), newName);
+
+ TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), annotationText);
change.setEdit(edit);
root.add(change);
root.addAll(changes.toArray(new Change[0]));
15 years, 8 months
JBoss Tools SVN: r14640 - in trunk/smooks/plugins: org.jboss.tools.smooks.ui/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-04-09 10:58:37 -0400 (Thu, 09 Apr 2009)
New Revision: 14640
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/javabean/provider/ValueTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
Log:
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/javabean/provider/ValueTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/javabean/provider/ValueTypeItemProvider.java 2009-04-09 14:45:50 UTC (rev 14639)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/javabean/provider/ValueTypeItemProvider.java 2009-04-09 14:58:37 UTC (rev 14640)
@@ -256,7 +256,7 @@
@Override
public String getText(Object object) {
String label = ((ValueType)object).getData();
- if(label.length() > 12){
+ if(label != null && label.length() > 12){
label = label.substring(0, 12) + "...";
}
return label == null || label.length() == 0 ?
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-04-09 14:45:50 UTC (rev 14639)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-04-09 14:58:37 UTC (rev 14640)
@@ -14,11 +14,11 @@
org.eclipse.ui.forms,
org.eclipse.wst.sse.core,
org.eclipse.wst.sse.ui,
- org.eclipse.emf;bundle-version="2.4.0",
- org.eclipse.emf.edit;bundle-version="2.4.2",
- org.eclipse.emf.edit.ui;bundle-version="2.4.2",
- org.eclipse.jdt.core;bundle-version="3.4.4",
- org.eclipse.jdt.ui;bundle-version="3.4.2"
+ org.eclipse.emf,
+ org.eclipse.emf.edit,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 14:45:50 UTC (rev 14639)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-09 14:58:37 UTC (rev 14640)
@@ -41,6 +41,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -165,7 +166,8 @@
.getEditorSite().getActionBarContributor());
}
smooksTreeViewer.addSelectionChangedListener(this);
-
+ tableComposite.setBackground(new Color(null,128,128,128));
+
gd = new GridData(GridData.FILL_BOTH);
tableComposite.setLayoutData(gd);
tool.paintBordersFor(tableComposite);
15 years, 8 months
JBoss Tools SVN: r14639 - trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-09 10:45:50 -0400 (Thu, 09 Apr 2009)
New Revision: 14639
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
Log:
JBIDE-4140
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2009-04-09 14:45:09 UTC (rev 14638)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/form/ManagedBeanPropertyForm.java 2009-04-09 14:45:50 UTC (rev 14639)
@@ -144,7 +144,7 @@
if (controls != null) anyLabel = controls[0];
}
if (PROPERTY_CLASS.equals(propertyEditor.getAttributeName())) {
- IPropertyFieldEditor wraper = new JavaHyperlinkLineFieldEditor(settings);
+ IPropertyFieldEditor wraper = (IPropertyFieldEditor)propertyEditor.getFieldEditor(composite);
ExtendedFieldEditor fe = (ExtendedFieldEditor)wraper;
fe.setLabelText(propertyEditor.getLabelText());
wraper.setPropertyEditor(propertyEditor);
15 years, 8 months
JBoss Tools SVN: r14638 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/model/ui/attribute/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-09 10:45:09 -0400 (Thu, 09 Apr 2009)
New Revision: 14638
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.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/attribute/editor/JavaChoicerEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkCellEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java
Log:
JBIDE-4140
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-04-09 14:45:09 UTC (rev 14638)
@@ -72,7 +72,7 @@
</attributeEditor>
<attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.MutableComboBoxEditor" id="MutableCombo">
</attributeEditor>
- <attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.JavaChoicerEditor" id="AccessibleJava">
+ <attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerEditor" id="AccessibleJava">
</attributeEditor>
<attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.StringEditor" id="AccessibleJava2">
</attributeEditor>
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaChoicerEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -17,6 +17,7 @@
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+@Deprecated
public class JavaChoicerEditor extends ValueEditor {
protected DialogCellEditorEx cellEditor;
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.attribute.editor;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
+
+import org.jboss.tools.common.meta.key.WizardKeys;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+public class JavaEclipseChoicerEditor extends ValueEditor {
+
+ protected JavaHyperlinkCellEditor cellEditor;
+ //protected JavaChoicerFieldEditor fieldEditor;
+ protected JavaHyperlinkLineFieldEditor fieldEditor;
+
+ public JavaEclipseChoicerEditor() {}
+
+ public JavaEclipseChoicerEditor(IWidgetSettings settings) {
+ super(settings);
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (cellEditor!=null) cellEditor.dispose();
+ cellEditor = null;
+ if (fieldEditor!=null) fieldEditor.dispose();
+ fieldEditor = null;
+ }
+
+ public boolean isGreedyEditor() {
+ return true;
+ }
+
+ protected CellEditor createCellEditor(Composite parent) {
+// cellEditor = new DialogCellEditorEx(parent, SWT.NONE);
+ cellEditor = new JavaHyperlinkCellEditor(parent, SWT.NONE);
+ cellEditor.setPropertyEditor(this);
+ return cellEditor;
+ }
+
+ protected ExtendedFieldEditor createFieldEditor(Composite parent) {
+ //fieldEditor = new JavaChoicerFieldEditor();
+ fieldEditor = new JavaHyperlinkLineFieldEditor(settings);
+ //fieldEditor.setLabelText(getLabelText());
+ return fieldEditor;
+ }
+
+ public String getChangeButtonName() {
+ return JFaceResources.getString("openBrowse");
+ }
+
+ public boolean callsExternal() {
+ return true;
+ }
+
+ public Object callExternal(Shell shell) {
+ IJavaProject jp = null;
+ DefaultValueAdapter adapter = (DefaultValueAdapter)getInput();
+ XModelObject o = adapter.getModelObject();
+ if(o != null) {
+ IProject p = EclipseResourceUtil.getProject(o);
+ if(p != null) {
+ jp = EclipseResourceUtil.getJavaProject(p);
+ }
+ }
+ String title = "Select " + getAttributeName();
+ if(adapter != null && adapter.getAttribute() != null) {
+ String key = "" + adapter.getAttribute().getModelEntity().getName() + "." + adapter.getAttribute().getName().replace(' ', '_') + ".edit";
+ String t = WizardKeys.getLabelText(key);
+ if(t != null) {
+ title = t;
+ } else {
+ title = "Select " + WizardKeys.getAttributeDisplayName(adapter.getAttribute(), true);
+ }
+ }
+
+ FilteredTypesSelectionDialog dialog = new FilteredTypesSelectionDialog(
+ shell,
+ false,
+ ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(),
+ SearchEngine.createJavaSearchScope(jp != null ? new IJavaElement[]{jp} : new IJavaElement[0]),
+ IJavaSearchConstants.TYPE);
+ dialog.setTitle(title);
+ IValueProvider valueProvider = (IValueProvider)adapter.getAdapter(IValueProvider.class);
+ String v = valueProvider.getStringValue(true);
+ dialog.setInitialPattern(v);
+ int status = dialog.open();
+ if(status == FilteredItemsSelectionDialog.OK) {
+ Object result = dialog.getFirstResult();
+ if(result instanceof IType) {
+ return ((IType)result).getFullyQualifiedName('.');
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaEclipseChoicerFieldEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -28,8 +28,8 @@
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.TypeNameMatch;
-import org.eclipse.jdt.internal.ui.dialogs.TypeInfoViewer;
-import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionComponent;
+//import org.eclipse.jdt.internal.ui.dialogs.TypeInfoViewer;
+//import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionComponent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
@@ -47,12 +47,13 @@
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+@Deprecated
public class JavaEclipseChoicerFieldEditor extends ExtendedFieldEditor implements IFieldEditor, IPropertyFieldEditor, PropertyChangeListener {
protected IPropertyEditor propertyEditor;
protected IValueChangeListener valueChangeListener;
protected IValueProvider valueProvider;
- protected TypeSelectionComponent tc;
+// protected TypeSelectionComponent tc;
protected String filter;
protected String javaProjectName;
@@ -75,9 +76,9 @@
}
protected void doStore() {
- if(tc != null && tc.getSelection() != null && tc.getSelection().length > 0) {
- valueProvider.setValue(tc.getSelection()[0].getFullyQualifiedName());
- }
+// if(tc != null && tc.getSelection() != null && tc.getSelection().length > 0) {
+// valueProvider.setValue(tc.getSelection()[0].getFullyQualifiedName());
+// }
}
public int getNumberOfControls() {
@@ -108,10 +109,10 @@
return SearchEngine.createJavaSearchScope(elements);
}
- private class TitleLabel implements TypeSelectionComponent.ITitleLabel {
- public void setText(String text) {
- }
- }
+// private class TitleLabel implements TypeSelectionComponent.ITitleLabel {
+// public void setText(String text) {
+// }
+// }
protected Control getControl(Composite parent) {
IJavaSearchScope scope = getScope();
@@ -123,9 +124,9 @@
filter = "java.lang.Object";
}
- tc = new TypeSelectionComponent(parent, 0, message, false, scope, 0/*IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE*/, Signature.getSimpleName(filter), new TitleLabel(), null);
- Composite composite = tc;
- tc.triggerSearch();
+// tc = new TypeSelectionComponent(parent, 0, message, false, scope, 0/*IJavaSearchConstants.CLASS + IJavaSearchConstants.INTERFACE*/, Signature.getSimpleName(filter), new TitleLabel(), null);
+ Composite composite = null; //tc;
+// tc.triggerSearch();
GridLayout layout = new GridLayout(1, false);
composite.setLayout(layout);
@@ -134,14 +135,14 @@
layout.marginHeight = 10;
layout.marginWidth = 10;
- tc.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- if(hasFocus(tc)) handle(tc.getSelection());
- }
- public void widgetSelected(SelectionEvent e) {
- if(hasFocus(tc)) handle(tc.getSelection());
- }
- });
+// tc.addSelectionListener(new SelectionListener() {
+// public void widgetDefaultSelected(SelectionEvent e) {
+// if(hasFocus(tc)) handle(tc.getSelection());
+// }
+// public void widgetSelected(SelectionEvent e) {
+// if(hasFocus(tc)) handle(tc.getSelection());
+// }
+// });
Table table = getTable();
if(table != null) {
@@ -157,19 +158,19 @@
}
Table getTable() {
- try {
- Field f = TypeSelectionComponent.class.getDeclaredField("fViewer");
- if(f == null) return null;
- f.setAccessible(true);
- TypeInfoViewer v = (TypeInfoViewer)f.get(tc);
- return v == null ? null : v.getTable();
- } catch (NoSuchFieldException ee) {
-
- } catch (IllegalArgumentException e2) {
-
- } catch (IllegalAccessException e3) {
-
- }
+// try {
+// Field f = TypeSelectionComponent.class.getDeclaredField("fViewer");
+// if(f == null) return null;
+// f.setAccessible(true);
+// TypeInfoViewer v = (TypeInfoViewer)f.get(tc);
+// return v == null ? null : v.getTable();
+// } catch (NoSuchFieldException ee) {
+//
+// } catch (IllegalArgumentException e2) {
+//
+// } catch (IllegalAccessException e3) {
+//
+// }
return null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkCellEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkCellEditor.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkCellEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -121,4 +121,10 @@
return classExists = (javaAdapter.getJavaElement() != null);
}
+ public Object callExternal(Shell shell) {
+ if(propertyEditor instanceof JavaEclipseChoicerEditor) {
+ return ((JavaEclipseChoicerEditor)propertyEditor).callExternal(shell);
+ }
+ return null;
+ }
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/JavaHyperlinkLineFieldEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -22,9 +22,13 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
+import org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.Action;
@@ -32,8 +36,11 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.FilteredItemsSelectionDialog;
import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -283,4 +290,11 @@
return SearchEngine.createJavaSearchScope(elements);
}
+ public Object callExternal(Shell shell) {
+ if(propertyEditor instanceof JavaEclipseChoicerEditor) {
+ return ((JavaEclipseChoicerEditor)propertyEditor).callExternal(shell);
+ }
+ return null;
+ }
+
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/StringButtonFieldEditorEx.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -202,6 +202,10 @@
protected String changePressed() {
if (propertyEditor!=null) {
+ if(((PropertyEditor)propertyEditor).callsExternal()) {
+ Object result = ((PropertyEditor)propertyEditor).callExternal(getShell());
+ return result != null ? result.toString() : null;
+ }
editorDialog = new PropertyEditorDialog(ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), propertyEditor);
//editorDialog.create();
//ExtendedFieldEditor fieldEditor = propertyEditor.getFieldEditor(null);
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/TabbedJavaChoicerFieldEditor.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -26,6 +26,7 @@
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+@Deprecated
public class TabbedJavaChoicerFieldEditor extends ExtendedFieldEditor implements IPropertyFieldEditor {
private static final String LAST_CHOICER = "TabbedJavaChoicerFieldEditor.LastChoicer";
@@ -44,13 +45,13 @@
public TabbedJavaChoicerFieldEditor(IWidgetSettings settings) {
super(settings);
classicEditor = new JavaChoicerFieldEditor(settings);
- eclipseEditor = new JavaEclipseChoicerFieldEditor(settings);
+// eclipseEditor = new JavaEclipseChoicerFieldEditor(settings);
favoritesEditor = new JavaFavoritesFieldEditor(settings);
}
public void setOwnerDialog(PropertyEditorDialog dialog) {
classicEditor.setOwnerDialog(dialog);
- eclipseEditor.setOwnerDialog(dialog);
+// eclipseEditor.setOwnerDialog(dialog);
favoritesEditor.setOwnerDialog(dialog);
}
@@ -97,9 +98,9 @@
gd.heightHint = WINDOW_HEIGHT;
tabbedPane.setLayoutData(gd);
// eclipse
- TabItem eclipseChooser = new TabItem(tabbedPane, SWT.NONE);
- eclipseChooser.setControl(createEclipseChooser(tabbedPane));
- eclipseChooser.setText(EditorMessages.getString("TabbedJavaChoicerFieldEditor.Tab2.Label"));
+// TabItem eclipseChooser = new TabItem(tabbedPane, SWT.NONE);
+// eclipseChooser.setControl(createEclipseChooser(tabbedPane));
+// eclipseChooser.setText(EditorMessages.getString("TabbedJavaChoicerFieldEditor.Tab2.Label"));
// classic
TabItem classicChooser = new TabItem(tabbedPane, SWT.NONE);
classicChooser.setControl(createClassicChooser(tabbedPane));
@@ -135,9 +136,9 @@
protected Control createClassicChooser(Composite parent) {
return classicEditor.getControls(parent)[0];
}
- protected Control createEclipseChooser(Composite parent) {
- return eclipseEditor.getControls(parent)[0];
- }
+// protected Control createEclipseChooser(Composite parent) {
+// return eclipseEditor.getControls(parent)[0];
+// }
protected Control createFavoritesChooser(Composite parent) {
return favoritesEditor.getControls(parent)[0];
}
@@ -146,7 +147,7 @@
public void setPropertyEditor(IPropertyEditor propertyEditor) {
this.propertyEditor = propertyEditor;
classicEditor.setPropertyEditor(propertyEditor);
- eclipseEditor.setPropertyEditor(propertyEditor);
+// eclipseEditor.setPropertyEditor(propertyEditor);
favoritesEditor.setPropertyEditor(propertyEditor);
}
@@ -161,7 +162,7 @@
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
if (classicEditor!=null) classicEditor.setEnabled(enabled);
- if (eclipseEditor!=null) eclipseEditor.setEnabled(enabled);
+// if (eclipseEditor!=null) eclipseEditor.setEnabled(enabled);
if (favoritesEditor!=null) favoritesEditor.setEnabled(enabled);
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Form.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -33,6 +33,7 @@
import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
import org.jboss.tools.common.model.ui.attribute.editor.IPropertyFieldEditor;
+import org.jboss.tools.common.model.ui.attribute.editor.JavaEclipseChoicerEditor;
import org.jboss.tools.common.model.ui.attribute.editor.TableStructuredEditor;
import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
@@ -118,7 +119,8 @@
for(int i=0; i<attributes.length; i++) {
IPropertyEditor editor = support.getPropertyEditorByName(attributes[i].getName());
if(editor != null) {
- if(attributes[i].getWraperClassName()!=null) {
+ if(attributes[i].getWraperClassName()!=null
+ && !(editor instanceof JavaEclipseChoicerEditor)) {
try {
Class wraperClass = Class.forName(attributes[i].getWraperClassName());
Constructor wraperConstructor = wraperClass.getConstructor(new Class[]{IWidgetSettings.class});
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java 2009-04-09 14:21:04 UTC (rev 14637)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/FormAttributeData.java 2009-04-09 14:45:09 UTC (rev 14638)
@@ -28,6 +28,7 @@
public FormAttributeData(String name, ILayoutDataFactory layoutDataFactory, String wraperClassName, int width, String displayname) {
this.name = name;
+ if(layoutDataFactory == null) layoutDataFactory = LayoutDataFactory.getInstance();
this.layoutDataFactory = layoutDataFactory;
this.wraperClassName = wraperClassName;
this.width = width;
15 years, 8 months
JBoss Tools SVN: r14637 - trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-09 10:21:04 -0400 (Thu, 09 Apr 2009)
New Revision: 14637
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SeamGenAction.java
Log:
JBIDE-4138 - just for SeamGenAction code cleanup
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SeamGenAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SeamGenAction.java 2009-04-09 14:16:36 UTC (rev 14636)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SeamGenAction.java 2009-04-09 14:21:04 UTC (rev 14637)
@@ -311,9 +311,11 @@
if(!empties.isEmpty()) {
File createTempFile = null;
+ FileOutputStream fos = null;
try {
createTempFile = File.createTempFile( "seamgenempty", "properties" );
- empties.store( new FileOutputStream(createTempFile), "File used to send intentionally empty valued properties" );
+ fos = new FileOutputStream(createTempFile);
+ empties.store( fos, "File used to send intentionally empty valued properties" );
}
catch (FileNotFoundException e) {
SeamGenPlugin.logError( "Error while running " + getTarget(), e );
@@ -321,6 +323,15 @@
catch (IOException e) {
SeamGenPlugin.logError( "Error while running " + getTarget(), e );
}
+ finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
if(createTempFile!=null) {
wc.setAttribute( IAntLaunchConfigurationConstants.ATTR_ANT_PROPERTY_FILES, createTempFile.toString() );
@@ -431,12 +442,14 @@
}
catch (Exception e) {
SeamGenPlugin.logError( "Error while loading seamgen properties", e );
+ }
+ finally {
if(fileInputStream!=null)
try {
fileInputStream.close();
}
catch (IOException e1) {
- SeamGenPlugin.logError( "Error while closing seamgen properties", e );
+ SeamGenPlugin.logError( "Error while closing seamgen properties", e1 );
}
}
return p;
15 years, 8 months
JBoss Tools SVN: r14636 - in trunk/hibernatetools: plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-09 10:16:36 -0400 (Thu, 09 Apr 2009)
New Revision: 14636
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/ExportImageActionTest.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/ExportImageAction.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF
Log:
JBIDE-4148 & JBIDE-4138
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2009-04-09 14:06:58 UTC (rev 14635)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2009-04-09 14:16:36 UTC (rev 14636)
@@ -20,6 +20,7 @@
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.hibernate.ui.veditor,
org.jboss.tools.hibernate.ui.veditor.editors,
+ org.jboss.tools.hibernate.ui.veditor.editors.actions,
org.jboss.tools.hibernate.ui.veditor.editors.command,
org.jboss.tools.hibernate.ui.veditor.editors.figures,
org.jboss.tools.hibernate.ui.veditor.editors.model,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/ExportImageAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/ExportImageAction.java 2009-04-09 14:06:58 UTC (rev 14635)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/ExportImageAction.java 2009-04-09 14:16:36 UTC (rev 14636)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.hibernate.ui.veditor.editors.actions;
import java.io.ByteArrayOutputStream;
@@ -2,2 +12,3 @@
import java.io.FileOutputStream;
+import java.io.IOException;
@@ -25,8 +36,12 @@
public class ExportImageAction extends Action {
public static final String ACTION_ID = "Export as Image"; //$NON-NLS-1$
+ public static final String[] dialogFilterExtensions = new String[] { "*.png", "*.jpg", "*.bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ public static final String[] dialogFilterNames = new String[] { UIVEditorMessages.ExportImageAction_png_format,
+ UIVEditorMessages.ExportImageAction_jpg_format, UIVEditorMessages.ExportImageAction_bmp_format };
private VisualEditor editor;
+ private FileDialog saveDialog = null;
public ExportImageAction(VisualEditor editor) {
this.editor = editor;
@@ -35,17 +50,28 @@
setImageDescriptor(ImageDescriptor.createFromFile(
VisualEditor.class,"icons/export.png")); //$NON-NLS-1$
}
+
+ /**
+ * main goal of this function to allow tests for
+ * ExportImageAction functionality
+ *
+ * @param saveDialog
+ */
+ public void setSaveDialog(FileDialog saveDialog) {
+ this.saveDialog = saveDialog;
+ }
public void run() {
- FileDialog saveDialog = new FileDialog(
+ if (saveDialog == null) {
+ saveDialog = new FileDialog(
this.editor.getSite().getShell(), SWT.SAVE);
- saveDialog
- .setFilterExtensions(new String[] { "*.png", "*.jpg", "*.bmp" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- saveDialog.setFilterNames(new String[] { UIVEditorMessages.ExportImageAction_png_format,
- UIVEditorMessages.ExportImageAction_jpg_format, UIVEditorMessages.ExportImageAction_bmp_format });
+ }
+ saveDialog.setFilterExtensions(dialogFilterExtensions);
+ saveDialog.setFilterNames(dialogFilterNames);
String filePath = saveDialog.open();
+ saveDialog = null;
if (filePath == null || filePath.trim().length() == 0) {
return;
}
@@ -53,24 +79,32 @@
IFigure fig = ((ScalableFreeformRootEditPart) this.editor
.getEditPartViewer().getRootEditPart())
.getLayer(LayerConstants.PRINTABLE_LAYERS);
+ int imageType = SWT.IMAGE_BMP;
+ if (filePath.toLowerCase().endsWith(".jpg")) { //$NON-NLS-1$
+ imageType = SWT.IMAGE_JPEG;
+ } else if (filePath.toLowerCase().endsWith(".png")) { //$NON-NLS-1$
+ imageType = SWT.IMAGE_PNG;
+ }
+ FileOutputStream outStream = null;
try {
- int imageType = SWT.IMAGE_BMP;
- if (filePath.toLowerCase().endsWith(".jpg")) { //$NON-NLS-1$
- imageType = SWT.IMAGE_JPEG;
- } else if (filePath.toLowerCase().endsWith(".png")) { //$NON-NLS-1$
- imageType = SWT.IMAGE_PNG;
- }
-
byte[] imageData = createImage(fig, imageType);
- FileOutputStream outStream = new FileOutputStream(filePath);
+ outStream = new FileOutputStream(filePath);
outStream.write(imageData);
outStream.flush();
- outStream.close();
- } catch (Throwable e) {
+ } catch (Exception e) {
MessageDialog.openInformation(this.editor.getSite().getShell(),
UIVEditorMessages.ExportImageAction_error, UIVEditorMessages.ExportImageAction_failed_to_export_image + e.getMessage());
return;
}
+ finally {
+ if (outStream != null) {
+ try {
+ outStream.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
}
/***
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF 2009-04-09 14:06:58 UTC (rev 14635)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF 2009-04-09 14:16:36 UTC (rev 14636)
@@ -6,6 +6,7 @@
Require-Bundle: org.junit;bundle-version="3.8.2",
org.eclipse.wst.common.project.facet.ui;bundle-version="1.3.0",
org.eclipse.jdt.core,
+ org.eclipse.gef,
org.hibernate.eclipse.console.test,
org.jboss.tools.hibernate.ui.veditor,
org.hibernate.eclipse
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/ExportImageActionTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/ExportImageActionTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/ExportImageActionTest.java 2009-04-09 14:16:36 UTC (rev 14636)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * 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.hibernate.ui.veditor.editors.actions.test;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.SWTGraphics;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
+import org.jboss.tools.hibernate.ui.veditor.editors.actions.ExportImageAction;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+
+import junit.framework.TestCase;
+
+/**
+ * for ExportImageAction class functionality test
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ExportImageActionTest extends TestCase {
+
+ public Mockery context = new Mockery() {
+ {
+ setImposteriser(ClassImposteriser.INSTANCE);
+ }
+ };
+
+ public void testAction() {
+
+ final VisualEditor editor = context.mock(VisualEditor.class);;
+ final FileDialog saveDialog = context.mock(FileDialog.class);;
+ final GraphicalViewer graphicalViewer = context.mock(GraphicalViewer.class);;
+ final ScalableFreeformRootEditPart scalableFreeformRootEditPart = context.mock(ScalableFreeformRootEditPart.class);;
+ final IFigure figure = context.mock(IFigure.class);;
+ final Control control = context.mock(Control.class);;
+ final Display display = context.mock(Display.class);;
+ final Rectangle rectangle = new Rectangle(0, 0, 20, 10);
+
+ context.checking(new Expectations() {
+ {
+ allowing(saveDialog).setFilterExtensions(ExportImageAction.dialogFilterExtensions);
+ allowing(saveDialog).setFilterNames(ExportImageAction.dialogFilterNames);
+
+ oneOf(saveDialog).open();
+ will(returnValue("test.jpg")); //$NON-NLS-1$
+
+ allowing(editor).getEditPartViewer();
+ will(returnValue(graphicalViewer));
+
+ allowing(graphicalViewer).getRootEditPart();
+ will(returnValue(scalableFreeformRootEditPart));
+
+ allowing(scalableFreeformRootEditPart).getLayer(LayerConstants.PRINTABLE_LAYERS);
+ will(returnValue(figure));
+
+ allowing(graphicalViewer).getControl();
+ will(returnValue(control));
+
+ allowing(control).getDisplay();
+ will(returnValue(display));
+
+ allowing(figure).getBounds();
+ will(returnValue(rectangle));
+
+ allowing(display).internal_new_GC(null);
+ will(returnValue(0));
+
+ allowing(display).internal_dispose_GC(0, null);
+
+ oneOf(figure).paint(with(any(SWTGraphics.class)));
+
+ allowing(display).isDisposed();
+ will(returnValue(true));
+ }
+ });
+ final ExportImageAction exportImageAction = new ExportImageAction(editor);
+ exportImageAction.setSaveDialog(saveDialog);
+ exportImageAction.run();
+ // GENERAL TEST:
+ // check for all expectations
+ context.assertIsSatisfied();
+
+ }
+
+
+}
15 years, 8 months
JBoss Tools SVN: r14635 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-04-09 10:06:58 -0400 (Thu, 09 Apr 2009)
New Revision: 14635
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077 progress monitor is shown while searching references
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 14:04:17 UTC (rev 14634)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-09 14:06:58 UTC (rev 14635)
@@ -118,9 +118,6 @@
this.newName = componentName;
annotation = getAnnotation(file);
-
- changes.clear();
- findReferences();
}
private IAnnotation getAnnotation(IFile file){
@@ -361,6 +358,10 @@
OperationCanceledException {
if(annotation == null)
return null;
+
+ changes.clear();
+ findReferences();
+
CompositeChange root = new CompositeChange("Rename Seam Component");
TextFileChange change = new TextFileChange(file.getName(), file);
TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), "@"+annotation.getElementName()+"(\""+newName+"\")");
15 years, 8 months
JBoss Tools SVN: r14633 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-09 09:28:48 -0400 (Thu, 09 Apr 2009)
New Revision: 14633
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
Log:
JBIDE-4138
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-09 13:22:12 UTC (rev 14632)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2009-04-09 13:28:48 UTC (rev 14633)
@@ -664,6 +664,7 @@
public void save(){
Properties properties = new Properties();
storeProperties(properties, this);
+ FileOutputStream fos = null;
try {
File folder = new File(getStoreFolderPath().toOSString());
if(!folder.exists()) {
@@ -673,10 +674,18 @@
if(!file.exists()) {
file.createNewFile();
}
- FileOutputStream fos = new FileOutputStream(file);
+ fos = new FileOutputStream(file);
properties.store(fos, ""); //$NON-NLS-1$
} catch (IOException e) {
VisualEditorPlugin.getDefault().logError("Can't save layout of mapping.", e); //$NON-NLS-1$
+ } finally {
+ if (fos != null) {
+ try {
+ fos.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
}
}
@@ -733,9 +742,9 @@
private void setState(Properties properties,String key, boolean value){
if(properties.containsKey(key)){
properties.remove(key);
- properties.put(key, new Boolean(value).toString());
+ properties.put(key, Boolean.valueOf(value).toString());
}else{
- properties.put(key, new Boolean(value).toString());
+ properties.put(key, Boolean.valueOf(value).toString());
}
}
@@ -746,7 +755,7 @@
private boolean getState(Properties properties, String key){
String str = properties.getProperty(key, "true"); //$NON-NLS-1$
- return new Boolean(str).booleanValue();
+ return Boolean.valueOf(str).booleanValue();
}
private Point getPoint(Properties properties, String key){
15 years, 8 months