JBoss Tools SVN: r16369 - trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-07-02 20:51:03 -0400 (Thu, 02 Jul 2009)
New Revision: 16369
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4432 Add or move "Show experimental sites" from prefences to the Project Examples wizard
Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2009-07-03 00:41:41 UTC (rev 16368)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2009-07-03 00:51:03 UTC (rev 16369)
@@ -17,6 +17,7 @@
import java.util.Set;
import java.util.TreeSet;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -54,6 +55,7 @@
private IStructuredSelection selection;
private Button showQuickFixButton;
+ private Combo siteCombo;
public NewProjectExamplesWizardPage() {
super("org.jboss.tools.project.examples"); //$NON-NLS-1$
@@ -79,19 +81,34 @@
gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
siteComposite.setLayoutData(gd);
+ final Button button = new Button(siteComposite,SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
+ gd.horizontalSpan = 2;
+ button.setLayoutData(gd);
+ button.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
+ IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ button.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ store.setValue(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES, button.getSelection());
+ if (siteCombo != null) {
+ String[] items = getItems();
+ siteCombo.setItems(items);
+ if (items.length > 0) {
+ siteCombo.select(0);
+ }
+ }
+ }
+
+ });
+
new Label(siteComposite,SWT.NONE).setText(Messages.NewProjectExamplesWizardPage_Site);
- final Combo siteCombo = new Combo(siteComposite,SWT.READ_ONLY);
+ siteCombo = new Combo(siteComposite,SWT.READ_ONLY);
siteCombo.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
- List<Category> categories = ProjectUtil.getProjects();
- Set<String> sites = new TreeSet<String>();
- sites.add(ProjectExamplesActivator.ALL_SITES);
- for (Category category:categories) {
- List<Project> projects = category.getProjects();
- for (Project project:projects) {
- sites.add(project.getSite());
- }
- }
- String[] items = sites.toArray(new String[0]);
+ String[] items = getItems();
siteCombo.setItems(items);
siteCombo.setText(ProjectExamplesActivator.ALL_SITES);
@@ -111,7 +128,7 @@
viewer.setLabelProvider(new ProjectLabelProvider());
viewer.setContentProvider(new ProjectContentProvider());
- final AdaptableList input = new AdaptableList(categories);
+ final AdaptableList input = new AdaptableList(getCategories());
final SiteFilter siteFilter = new SiteFilter();
viewer.addFilter(siteFilter);
@@ -200,6 +217,24 @@
setControl(composite);
}
+ private List<Category> getCategories() {
+ return ProjectUtil.getProjects();
+ }
+
+ private String[] getItems() {
+ List<Category> categories = getCategories();
+ Set<String> sites = new TreeSet<String>();
+ sites.add(ProjectExamplesActivator.ALL_SITES);
+ for (Category category:categories) {
+ List<Project> projects = category.getProjects();
+ for (Project project:projects) {
+ sites.add(project.getSite());
+ }
+ }
+ String[] items = sites.toArray(new String[0]);
+ return items;
+ }
+
private class ProjectLabelProvider extends LabelProvider {
@Override
14 years, 9 months
JBoss Tools SVN: r16368 - branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-07-02 20:41:41 -0400 (Thu, 02 Jul 2009)
New Revision: 16368
Added:
branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/license.html
Log:
https://jira.jboss.org/jira/browse/JBIDE-4564 license file added
Added: branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/license.html
===================================================================
--- branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/license.html (rev 0)
+++ branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/license.html 2009-07-03 00:41:41 UTC (rev 16368)
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
Property changes on: branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/license.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Tools SVN: r16367 - branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-07-02 20:39:26 -0400 (Thu, 02 Jul 2009)
New Revision: 16367
Modified:
branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/build.properties
branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.properties
branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4564 fixed
Modified: branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/build.properties
===================================================================
--- branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/build.properties 2009-07-02 21:39:38 UTC (rev 16366)
+++ branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/build.properties 2009-07-03 00:39:26 UTC (rev 16367)
@@ -1,7 +1,2 @@
-bin.includes = feature.xml
-
-generate.feature(a)org.jboss.tools.flow.jpdl4.source.feature=org.jboss.tools.flow.jpdl4.feature
-generate.feature(a)org.jboss.tools.flow.common.source.feature=org.jboss.tools.flow.common.feature
-generate.feature(a)org.jboss.tools.jbpm.common.source.feature=org.jboss.tools.jbpm.common.feature
-generate.feature(a)org.jboss.tools.jbpm.convert.source.feature=org.jboss.tools.jbpm.convert.feature
-generate.feature(a)org.jbpm.gd.jpdl.source.feature=org.jbpm.gd.jpdl.feature
+bin.includes = feature.xml,\
+ feature.properties
Modified: branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.properties
===================================================================
--- branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.properties 2009-07-02 21:39:38 UTC (rev 16366)
+++ branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.properties 2009-07-03 00:39:26 UTC (rev 16367)
@@ -1,8 +1,9 @@
-featureName=All jBPM 4 Tools Features
+featureName=jBPM 4 Tools
featureProvider=JBoss by Red Hat
description=This feature includes all end-user tools for jBPM 4, including runtime and sources.
copyright=Copyright 2009 Red Hat, Inc.
-licenseURL=http://www.eclipse.org/legal/epl-v10.html
+licenseURL=license.html
+updateSiteName=JBossTools Update Site
license= Eclipse Public License - v 1.0\n\
\n\
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.\n\
Modified: branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.xml
===================================================================
--- branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.xml 2009-07-02 21:39:38 UTC (rev 16366)
+++ branches/jbosstools-3.1.0.M2/jbpm/features/org.jboss.tools.jbpm4.feature/feature.xml 2009-07-03 00:39:26 UTC (rev 16367)
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.jboss.tools.jbpm4.feature"
- label="%"
- version="4.0.0.qualifier">
+ label="%featureName"
+ version="4.0.0.qualifier"
+ provider-name="%providerName">
<description>
%description
@@ -16,7 +17,11 @@
%license
</license>
- <includes
+ <url>
+ <update label="%updateSiteName" url="http://download.jboss.org/jbosstools/updates/stable"/>
+ </url>
+
+ <includes
id="org.jboss.tools.jbpm.common.feature"
version="0.0.0"/>
@@ -28,5 +33,4 @@
id="org.jboss.tools.flow.jpdl4.feature"
version="0.0.0"/>
-
</feature>
14 years, 9 months
JBoss Tools SVN: r16365 - trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-07-02 15:51:46 -0400 (Thu, 02 Jul 2009)
New Revision: 16365
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
Log:
remove duplicate edit domain (and command stack)
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2009-07-02 19:48:20 UTC (rev 16364)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlEditor.java 2009-07-02 19:51:46 UTC (rev 16365)
@@ -13,7 +13,6 @@
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.DefaultEditDomain;
import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.commands.CommandStack;
import org.eclipse.gef.editparts.LayerManager;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.swt.SWT;
14 years, 9 months
JBoss Tools SVN: r16364 - trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-07-02 15:48:20 -0400 (Thu, 02 Jul 2009)
New Revision: 16364
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
Log:
remove duplicate edit domain (and command stack)
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2009-07-02 19:44:22 UTC (rev 16363)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/editor/GenericModelEditor.java 2009-07-02 19:48:20 UTC (rev 16364)
@@ -105,7 +105,6 @@
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
super.init(site, input);
- initializeEditDomain();
initializeLanguage();
}
14 years, 9 months
JBoss Tools SVN: r16363 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors: model/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 15:44:22 -0400 (Thu, 02 Jul 2009)
New Revision: 16363
Modified:
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/model/test/OrmDiagramTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: 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 2009-07-02 19:41:33 UTC (rev 16362)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/actions/test/ExportImageActionTest.java 2009-07-02 19:44:22 UTC (rev 16363)
@@ -21,8 +21,8 @@
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.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.ExportImageAction;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.legacy.ClassImposteriser;
@@ -44,7 +44,7 @@
public void testAction() {
- final VisualEditor editor = context.mock(VisualEditor.class);;
+ final DiagramViewer editor = context.mock(DiagramViewer.class);;
final FileDialog saveDialog = context.mock(FileDialog.class);;
final GraphicalViewer graphicalViewer = context.mock(GraphicalViewer.class);;
final ScalableFreeformRootEditPart scalableFreeformRootEditPart = context.mock(ScalableFreeformRootEditPart.class);;
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java 2009-07-02 19:41:33 UTC (rev 16362)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/veditor/editors/model/test/OrmDiagramTest.java 2009-07-02 19:44:22 UTC (rev 16363)
@@ -17,7 +17,7 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.mapping.RootClass;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.legacy.ClassImposteriser;
14 years, 9 months
JBoss Tools SVN: r16362 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 15:41:33 -0400 (Thu, 02 Jul 2009)
New Revision: 16362
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/VisualEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/VisualEditor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/VisualEditor.java 2009-07-02 18:56:47 UTC (rev 16361)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/VisualEditor.java 2009-07-02 19:41:33 UTC (rev 16362)
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
-import org.eclipse.gef.requests.CreationFactory;
-import org.eclipse.gef.requests.SimpleFactory;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.WorkbenchPartAction;
-import org.eclipse.gef.ui.parts.GraphicalEditor;
-import org.eclipse.gef.ui.parts.TreeViewer;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.TransferDropTargetListener;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.RootClass;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.AutoLayoutAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.ExportImageAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenMappingAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenSourceAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.veditor.editors.parts.GEFRootEditPart;
-import org.jboss.tools.hibernate.ui.veditor.editors.parts.OrmEditPart;
-import org.jboss.tools.hibernate.ui.veditor.editors.parts.OrmEditPartFactory;
-import org.jboss.tools.hibernate.ui.veditor.editors.popup.PopupMenuProvider;
-import org.jboss.tools.hibernate.ui.view.views.ObjectEditorInput;
-
-public class VisualEditor extends GraphicalEditor {
-
- private OrmDiagram ormDiagram = null;
-
- public VisualEditor() {
- setEditDomain(new DefaultEditDomain(this));
- }
-
- public void doSave(IProgressMonitor monitor) {
- ormDiagram.save();
- ormDiagram.setDirty(false);
- }
-
- public void doSaveAs() {
- }
-
- protected void initializeGraphicalViewer() {
- final GraphicalViewer viewer = getGraphicalViewer();
- viewer.setEditPartFactory(new OrmEditPartFactory());
- viewer.setRootEditPart(new GEFRootEditPart());
- viewer.addDropTargetListener(createTransferDropTargetListener());
- viewer.setContents(ormDiagram);
-
- PopupMenuProvider provider = new PopupMenuProvider(viewer, getActionRegistry());
- viewer.setContextMenu(provider);
- getSite().registerContextMenu("FlowDiagramContextmenu", provider, viewer); //$NON-NLS-1$
- }
-
- public GraphicalViewer getEditPartViewer() {
- return getGraphicalViewer();
- }
-
- protected void createActions() {
-
- getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(),new WorkbenchPartAction(this){
-
- protected boolean calculateEnabled() {
- return true;
- }
- public void run() {
- ormDiagram.refresh();
- }
- });
-
- super.createActions();
-
- getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), getActionRegistry().getAction(ActionFactory.PRINT.getId()));
-
- ActionRegistry registry = getActionRegistry();
- IAction action;
-
- action = new OpenMappingAction(this);
- registry.registerAction(action);
-
- action = new OpenSourceAction(this);
- registry.registerAction(action);
-
- action = new ExportImageAction(this);
- registry.registerAction(action);
-
- action = new AutoLayoutAction(this);
- registry.registerAction(action);
-
- }
-
- private TransferDropTargetListener createTransferDropTargetListener() {
- return new TemplateTransferDropTargetListener(getGraphicalViewer()) {
- protected CreationFactory getFactory(Object template) {
- return new SimpleFactory((Class<?>) template);
- }
- };
- }
-
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- public boolean isSaveOnCloseNeeded() {
- return true;
- }
-
- public void refreshDirty() {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
-
- public boolean isDirty() {
- return ormDiagram.isDirty();
- }
-
- protected void setInput(IEditorInput input) {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
- ConsoleConfiguration configuration = objectEditorInput.getConfiguration();
- Object obj = objectEditorInput.getObject();
- if (obj instanceof RootClass) {
- RootClass rootClass = (RootClass)obj;
- setPartName(UIVEditorMessages.VisualEditor_diagram_for + rootClass.getEntityName());
- ormDiagram = new OrmDiagram(configuration, rootClass);
- } else if (obj instanceof RootClass[]) {
- RootClass[] rootClasses = (RootClass[])obj;
- String name = rootClasses.length > 0 ? rootClasses[0].getEntityName() : ""; //$NON-NLS-1$
- for (int i = 1; i < rootClasses.length; i++) {
- name += " & " + rootClasses[i].getEntityName(); //$NON-NLS-1$
- }
- setPartName(UIVEditorMessages.VisualEditor_diagram_for + name);
- ormDiagram = new OrmDiagram(configuration, rootClasses);
- }
- super.setInput(input);
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class type) {
- if (type == IContentOutlinePage.class) {
- DiagramContentOutlinePage outline = new DiagramContentOutlinePage(
- new TreeViewer());
- outline.setGraphicalViewer(getGraphicalViewer());
- outline.setSelectionSynchronizer(getSelectionSynchronizer());
- outline.setOrmDiagram(ormDiagram);
- outline.setEditor(this);
- return outline;
- }
-
- return super.getAdapter(type);
- }
-
- public Set<Object> getSelectedElements() {
- Set<Object> ret = new HashSet<Object>();
- List<?> selectedEditParts = getGraphicalViewer().getSelectedEditParts();
- Iterator<?> iterator = selectedEditParts.iterator();
- while (iterator.hasNext()) {
- Object elem = iterator.next();
- if (elem instanceof OrmEditPart) {
- Shape shape = (Shape)((OrmEditPart)elem).getModel();
- Object ormElement = shape.getOrmElement();
- if (ormElement instanceof Column){
- shape = (Shape) shape.getParent();
- }
- ret.add(shape.getOrmElement());
- }
- }
- return ret;
- }
-
- public OrmDiagram getViewerContents() {
- return ormDiagram;
- }
-
- public DefaultEditDomain getDefaultEditDomain() {
- return getEditDomain();
- }
-
-}
14 years, 9 months
JBoss Tools SVN: r16361 - in trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui: diagram and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:56:47 -0400 (Thu, 02 Jul 2009)
New Revision: 16361
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/test/ExportImageActionTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/test/
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/test/UiTestPlugin.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/test/ExportImageActionTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/test/ExportImageActionTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/test/ExportImageActionTest.java 2009-07-02 18:56:47 UTC (rev 16361)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.diagram.editors.actions.test;
+
+import java.io.File;
+
+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.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.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 DiagramViewer editor = context.mock(DiagramViewer.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);
+ final String filePath = "test.jpg"; //$NON-NLS-1$
+
+ context.checking(new Expectations() {
+ {
+ allowing(saveDialog).setFilterExtensions(ExportImageAction.dialogFilterExtensions);
+ allowing(saveDialog).setFilterNames(ExportImageAction.dialogFilterNames);
+
+ oneOf(saveDialog).open();
+ will(returnValue(filePath));
+
+ 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();
+ // test is the file created
+ File file = new File(filePath);
+ assertTrue(file.exists() && file.isFile());
+ //
+ boolean res = file.delete();
+ assertTrue(res);
+ // GENERAL TEST:
+ // check for all expectations
+ context.assertIsSatisfied();
+
+ }
+
+
+}
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java 2009-07-02 18:56:47 UTC (rev 16361)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.diagram.editors.model.test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+
+import junit.framework.TestCase;
+
+/**
+ * for OrmDiagram class functionality test
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class OrmDiagramTest extends TestCase {
+
+ public Mockery context = new Mockery() {
+ {
+ setImposteriser(ClassImposteriser.INSTANCE);
+ }
+ };
+
+ public void testLoadAndSave() {
+
+ final ConsoleConfiguration consoleConfig = context.mock(ConsoleConfiguration.class);
+ final RootClass ioe = context.mock(RootClass.class);
+ final List<Object> emptyList = new ArrayList<Object>();
+ final Iterator<Object> emptyListIterator = emptyList.iterator();
+
+ context.checking(new Expectations() {
+ {
+ oneOf(ioe).getEntityName();
+ will(returnValue("testEntityName")); //$NON-NLS-1$
+
+ oneOf(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+
+ oneOf(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+
+ oneOf(ioe).getIdentifierProperty();
+ will(returnValue(null));
+
+ oneOf(ioe).getIdentifier();
+ will(returnValue(null));
+
+ oneOf(ioe).getPropertyIterator();
+ will(returnValue(emptyListIterator));
+
+ oneOf(ioe).getTable();
+ will(returnValue(null));
+
+ oneOf(ioe).getSubclassIterator();
+ will(returnValue(emptyListIterator));
+
+ oneOf(ioe).getIdentifier();
+ will(returnValue(null));
+
+ oneOf(ioe).getJoinIterator();
+ will(returnValue(emptyListIterator));
+
+ allowing(ioe).getNodeName();
+ will(returnValue("NodeName")); //$NON-NLS-1$
+
+ allowing(ioe).getClassName();
+ will(returnValue("ClassName")); //$NON-NLS-1$
+
+ allowing(consoleConfig).getName();
+ will(returnValue("CCName")); //$NON-NLS-1$
+
+ allowing(ioe).getEntityName();
+ will(returnValue("")); //$NON-NLS-1$
+ }
+ });
+ final OrmDiagram ormDiagram = new OrmDiagram(consoleConfig, ioe);
+ ormDiagram.save();
+ // test is the folder created
+ File folder = new File(ormDiagram.getStoreFolderPath().toOSString());
+ assertTrue(folder.exists() && folder.isDirectory());
+ // test is the file created
+ File file = new File(ormDiagram.getStoreFilePath().toOSString());
+ assertTrue(file.exists() && file.isFile());
+ //
+ boolean res = file.delete();
+ assertTrue(res);
+ //
+ res = folder.delete();
+ assertTrue(res);
+ // GENERAL TEST:
+ // check for all expectations
+ context.assertIsSatisfied();
+ }
+
+}
Added: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/test/UiTestPlugin.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/test/UiTestPlugin.java (rev 0)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/src/org/jboss/tools/hibernate/ui/test/UiTestPlugin.java 2009-07-02 18:56:47 UTC (rev 16361)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class UiTestPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.hibernate.ui.test"; //$NON-NLS-1$
+
+ // The shared instance
+ private static UiTestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public UiTestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ setPlugin(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ setPlugin(null);
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static UiTestPlugin getDefault() {
+ return plugin;
+ }
+
+ private static void setPlugin(UiTestPlugin plugin) {
+ UiTestPlugin.plugin = plugin;
+ }
+
+ public File getFileInPlugin(IPath path) throws CoreException {
+ try {
+ URL installURL = new URL(getBundle().getEntry("/"), path.toString()); //$NON-NLS-1$
+ URL localURL = FileLocator.toFileURL(installURL);
+ return new File(localURL.getFile());
+ } catch (IOException e) {
+ throw new CoreException(new Status(IStatus.ERROR, getBundle()
+ .getSymbolicName(), IStatus.ERROR, e.getMessage(), e));
+ }
+ }
+
+}
14 years, 9 months
JBoss Tools SVN: r16360 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:55:41 -0400 (Thu, 02 Jul 2009)
New Revision: 16360
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java 2009-07-02 18:55:41 UTC (rev 16360)
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.diagram.editors;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.WorkbenchPartAction;
+import org.eclipse.gef.ui.parts.GraphicalEditor;
+import org.eclipse.gef.ui.parts.TreeViewer;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.util.TransferDropTargetListener;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.AutoLayoutAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.ExportImageAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.OpenMappingAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.OpenSourceAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.GEFRootEditPart;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPart;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPartFactory;
+import org.jboss.tools.hibernate.ui.diagram.editors.popup.PopupMenuProvider;
+import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
+
+public class DiagramViewer extends GraphicalEditor {
+
+ private OrmDiagram ormDiagram = null;
+
+ public DiagramViewer() {
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ ormDiagram.save();
+ ormDiagram.setDirty(false);
+ }
+
+ public void doSaveAs() {
+ }
+
+ protected void initializeGraphicalViewer() {
+ final GraphicalViewer viewer = getGraphicalViewer();
+ viewer.setEditPartFactory(new OrmEditPartFactory());
+ viewer.setRootEditPart(new GEFRootEditPart());
+ viewer.addDropTargetListener(createTransferDropTargetListener());
+ viewer.setContents(ormDiagram);
+
+ PopupMenuProvider provider = new PopupMenuProvider(viewer, getActionRegistry());
+ viewer.setContextMenu(provider);
+ getSite().registerContextMenu("FlowDiagramContextmenu", provider, viewer); //$NON-NLS-1$
+ }
+
+ public GraphicalViewer getEditPartViewer() {
+ return getGraphicalViewer();
+ }
+
+ protected void createActions() {
+
+ getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(),new WorkbenchPartAction(this){
+
+ protected boolean calculateEnabled() {
+ return true;
+ }
+ public void run() {
+ ormDiagram.refresh();
+ }
+ });
+
+ super.createActions();
+
+ getEditorSite().getActionBars().setGlobalActionHandler(ActionFactory.PRINT.getId(), getActionRegistry().getAction(ActionFactory.PRINT.getId()));
+
+ ActionRegistry registry = getActionRegistry();
+ IAction action;
+
+ action = new OpenMappingAction(this);
+ registry.registerAction(action);
+
+ action = new OpenSourceAction(this);
+ registry.registerAction(action);
+
+ action = new ExportImageAction(this);
+ registry.registerAction(action);
+
+ action = new AutoLayoutAction(this);
+ registry.registerAction(action);
+
+ }
+
+ private TransferDropTargetListener createTransferDropTargetListener() {
+ return new TemplateTransferDropTargetListener(getGraphicalViewer()) {
+ protected CreationFactory getFactory(Object template) {
+ return new SimpleFactory((Class<?>) template);
+ }
+ };
+ }
+
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ public boolean isSaveOnCloseNeeded() {
+ return true;
+ }
+
+ public void refreshDirty() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+
+ public boolean isDirty() {
+ return ormDiagram.isDirty();
+ }
+
+ protected void setInput(IEditorInput input) {
+ ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
+ ConsoleConfiguration configuration = objectEditorInput.getConfiguration();
+ Object obj = objectEditorInput.getObject();
+ if (obj instanceof RootClass) {
+ RootClass rootClass = (RootClass)obj;
+ setPartName(DiagramViewerMessages.DiagramViewer_diagram_for + rootClass.getEntityName());
+ ormDiagram = new OrmDiagram(configuration, rootClass);
+ } else if (obj instanceof RootClass[]) {
+ RootClass[] rootClasses = (RootClass[])obj;
+ String name = rootClasses.length > 0 ? rootClasses[0].getEntityName() : ""; //$NON-NLS-1$
+ for (int i = 1; i < rootClasses.length; i++) {
+ name += " & " + rootClasses[i].getEntityName(); //$NON-NLS-1$
+ }
+ setPartName(DiagramViewerMessages.DiagramViewer_diagram_for + name);
+ ormDiagram = new OrmDiagram(configuration, rootClasses);
+ }
+ super.setInput(input);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class type) {
+ if (type == IContentOutlinePage.class) {
+ DiagramContentOutlinePage outline = new DiagramContentOutlinePage(
+ new TreeViewer());
+ outline.setGraphicalViewer(getGraphicalViewer());
+ outline.setSelectionSynchronizer(getSelectionSynchronizer());
+ outline.setOrmDiagram(ormDiagram);
+ outline.setEditor(this);
+ return outline;
+ }
+
+ return super.getAdapter(type);
+ }
+
+ public Set<Object> getSelectedElements() {
+ Set<Object> ret = new HashSet<Object>();
+ List<?> selectedEditParts = getGraphicalViewer().getSelectedEditParts();
+ Iterator<?> iterator = selectedEditParts.iterator();
+ while (iterator.hasNext()) {
+ Object elem = iterator.next();
+ if (elem instanceof OrmEditPart) {
+ Shape shape = (Shape)((OrmEditPart)elem).getModel();
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof Column){
+ shape = (Shape) shape.getParent();
+ }
+ ret.add(shape.getOrmElement());
+ }
+ }
+ return ret;
+ }
+
+ public Set<Object> getSelectedElements2() {
+ Set<Object> ret = new HashSet<Object>();
+ List<?> selectedEditParts = getGraphicalViewer().getSelectedEditParts();
+ Iterator<?> iterator = selectedEditParts.iterator();
+ while (iterator.hasNext()) {
+ Object elem = iterator.next();
+ if (elem instanceof OrmEditPart) {
+ Shape shape = (Shape)((OrmEditPart)elem).getModel();
+ Object ormElement = shape.getOrmElement();
+ ret.add(ormElement);
+ }
+ }
+ return ret;
+ }
+
+ public OrmDiagram getViewerContents() {
+ return ormDiagram;
+ }
+
+ public DefaultEditDomain getDefaultEditDomain() {
+ return getEditDomain();
+ }
+
+}
14 years, 9 months
JBoss Tools SVN: r16359 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:44:45 -0400 (Thu, 02 Jul 2009)
New Revision: 16359
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
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-07-02 18:42:04 UTC (rev 16358)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/META-INF/MANIFEST.MF 2009-07-02 18:44:45 UTC (rev 16359)
@@ -1,19 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.tools.hibernate.ui.veditor.test
+Bundle-SymbolicName: org.jboss.tools.hibernate.ui.test
Bundle-Version: 1.0.0
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.jboss.tools.hibernate.ui,
org.hibernate.eclipse
Bundle-ActivationPolicy: lazy
-Export-Package: org.jboss.tools.hibernate.ui.veditor.test
-Bundle-Activator: org.jboss.tools.hibernate.ui.veditor.test.VisualEditorTestPlugin
-Bundle-ClassPath: org.jboss.tools.hibernate.ui.veditor.test.jar
+Export-Package: org.jboss.tools.hibernate.ui.test
+Bundle-Activator: org.jboss.tools.hibernate.ui.test.UiTestPlugin
+Bundle-ClassPath: org.jboss.tools.hibernate.ui.diagram.test.jar
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Import-Package: org.eclipse.core.resources
14 years, 9 months