JBoss Tools SVN: r18068 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors: command and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-10-13 10:31:24 -0400 (Tue, 13 Oct 2009)
New Revision: 18068
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/AutoLayoutCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/CollapseAllCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ExpandAllCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleAssociationCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleClassMappingCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleConnectionsCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleForeignKeyConstraintCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/TogglePropertyMappingCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeExpandStateCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeVisibleStateCommand.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleAssociationAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleClassMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleForeignKeyConstraintAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/TogglePropertyMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4694 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.AutoLayoutCommand;
/**
* @author some modifications from Vitali
@@ -32,6 +35,12 @@
}
public void run() {
- getDiagramViewer().getOrmDiagram().autolayout();
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new AutoLayoutCommand(getDiagramViewer().getOrmDiagram()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,8 +10,11 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.CollapseAllCommand;
/**
* @author Vitali Yemialyanchyk
@@ -29,6 +32,12 @@
}
public void run() {
- getDiagramViewer().getOrmDiagram().collapseAll();
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new CollapseAllCommand(getDiagramViewer().getOrmDiagram()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
@@ -57,4 +59,27 @@
}
return res;
}
+
+ /**
+ * Executes the given {@link Command} using the command stack. The stack is obtained by
+ * calling {@link #getCommandStack()}, which uses <code>IAdapatable</code> to retrieve the
+ * stack from the workbench part.
+ * @param command the command to execute
+ */
+ protected void execute(Command command) {
+ if (command == null || !command.canExecute()) {
+ return;
+ }
+ getCommandStack().execute(command);
+ }
+
+ /**
+ * Returns the editor's command stack. This is done by asking the workbench part for its
+ * CommandStack via
+ * {@link org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)}.
+ * @return the command stack
+ */
+ protected CommandStack getCommandStack() {
+ return (CommandStack)getDiagramViewer().getAdapter(CommandStack.class);
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,8 +10,11 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ExpandAllCommand;
/**
* @author Vitali Yemialyanchyk
@@ -29,6 +32,12 @@
}
public void run() {
- getDiagramViewer().getOrmDiagram().expandAll();
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new ExpandAllCommand(getDiagramViewer().getOrmDiagram()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleAssociationAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleAssociationAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleAssociationAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleAssociationCommand;
/**
* Show|Hide connections which type is "Associations" (class associations).
@@ -36,7 +39,12 @@
}
public void run() {
- boolean state = getDiagramViewer().getConnectionsVisibilityAssociation();
- getDiagramViewer().setConnectionsVisibilityAssociation(!state);
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new ToggleAssociationCommand(getDiagramViewer()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleClassMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleClassMappingAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleClassMappingAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleClassMappingCommand;
/**
* Show|Hide connections which type is "Class Mappings" (class->table).
@@ -36,7 +39,12 @@
}
public void run() {
- boolean state = getDiagramViewer().getConnectionsVisibilityClassMapping();
- getDiagramViewer().setConnectionsVisibilityClassMapping(!state);
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new ToggleClassMappingCommand(getDiagramViewer()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleConnectionsCommand;
/**
* Show|Hide all connections.
@@ -34,13 +37,12 @@
}
public void run() {
- boolean state = getDiagramViewer().getConnectionsVisibilityAssociation();
- getDiagramViewer().setConnectionsVisibilityAssociation(!state);
- state = getDiagramViewer().getConnectionsVisibilityClassMapping();
- getDiagramViewer().setConnectionsVisibilityClassMapping(!state);
- state = getDiagramViewer().getConnectionsVisibilityForeignKeyConstraint();
- getDiagramViewer().setConnectionsVisibilityForeignKeyConstraint(!state);
- state = getDiagramViewer().getConnectionsVisibilityPropertyMapping();
- getDiagramViewer().setConnectionsVisibilityPropertyMapping(!state);
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new ToggleConnectionsCommand(getDiagramViewer()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleForeignKeyConstraintAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleForeignKeyConstraintAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleForeignKeyConstraintAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleForeignKeyConstraintCommand;
/**
* Show|Hide connections which type is "Foreign key constraints"
@@ -37,10 +40,15 @@
}
public void run() {
- boolean state = getDiagramViewer().getConnectionsVisibilityForeignKeyConstraint();
- getDiagramViewer().setConnectionsVisibilityForeignKeyConstraint(!state);
+ execute(getCommand());
}
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new ToggleForeignKeyConstraintCommand(getDiagramViewer()));
+ return cc;
+ }
+
@Override
public boolean isEnabled() {
// TODO: JBIDE-4956 -> still not implemented
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/TogglePropertyMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/TogglePropertyMappingAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/TogglePropertyMappingAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -10,9 +10,12 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.TogglePropertyMappingCommand;
/**
* Show|Hide connections which type is "Property Mappings" (property->column).
@@ -36,7 +39,12 @@
}
public void run() {
- boolean state = getDiagramViewer().getConnectionsVisibilityPropertyMapping();
- getDiagramViewer().setConnectionsVisibilityPropertyMapping(!state);
+ execute(getCommand());
}
+
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
+ cc.add(new TogglePropertyMappingCommand(getDiagramViewer()));
+ return cc;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -14,12 +14,15 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.editparts.AbstractTreeEditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IWorkbenchPart;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleShapeExpandStateCommand;
import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandableShape;
import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPart;
@@ -42,10 +45,15 @@
setImageDescriptor(img);
}
+ public void run() {
+ execute(getCommand());
+ }
+
@SuppressWarnings("unchecked")
- public void run() {
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
if (getSelectedObjects().isEmpty()) {
- return;
+ return cc;
}
List<ExpandableShape> selectedShape = new ArrayList<ExpandableShape>();
Iterator it = getSelectedObjects().iterator();
@@ -61,9 +69,10 @@
selectedShape.add((ExpandableShape)obj);
}
}
- for (ExpandableShape shape : selectedShape) {
- shape.setExpanded(!shape.isExpanded());
+ if (selectedShape.size() > 0) {
+ cc.add(new ToggleShapeExpandStateCommand(selectedShape));
}
+ return cc;
}
@Override
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -14,6 +14,8 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.editparts.AbstractTreeEditPart;
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -22,6 +24,7 @@
import org.hibernate.mapping.Table;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ToggleShapeVisibleStateCommand;
import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPart;
@@ -44,10 +47,15 @@
setImageDescriptor(img);
}
+ public void run() {
+ execute(getCommand());
+ }
+
@SuppressWarnings("unchecked")
- public void run() {
+ public Command getCommand() {
+ CompoundCommand cc = new CompoundCommand();
if (getSelectedObjects().isEmpty()) {
- return;
+ return cc;
}
List<OrmShape> selectedShape = new ArrayList<OrmShape>();
Iterator it = getSelectedObjects().iterator();
@@ -63,12 +71,10 @@
selectedShape.add((OrmShape)obj);
}
}
- for (OrmShape shape : selectedShape) {
- Object ormElement = shape.getOrmElement();
- if (ormElement instanceof PersistentClass || ormElement instanceof Table) {
- shape.setVisible(!shape.isVisible());
- }
+ if (selectedShape.size() > 0) {
+ cc.add(new ToggleShapeVisibleStateCommand(selectedShape));
}
+ return cc;
}
@Override
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/AutoLayoutCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/AutoLayoutCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/AutoLayoutCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.command;
+
+import java.util.HashMap;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class AutoLayoutCommand extends Command {
+
+ protected HashMap<String, Point> elLocations;
+ protected OrmDiagram ormDiagram;
+
+ public AutoLayoutCommand(OrmDiagram ormDiagram) {
+ this.ormDiagram = ormDiagram;
+ elLocations = null;
+ }
+
+ public void execute() {
+ elLocations = ormDiagram.getElementsLocations();
+ ormDiagram.autolayout();
+ }
+
+ public void undo() {
+ if (elLocations != null) {
+ ormDiagram.setElementsLocations(elLocations);
+ }
+ }
+
+ public boolean canUndo() {
+ return (elLocations != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/CollapseAllCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/CollapseAllCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/CollapseAllCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.command;
+
+import java.util.HashMap;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class CollapseAllCommand extends Command {
+
+ protected HashMap<String, Boolean> elExpState;
+ protected OrmDiagram ormDiagram;
+
+ public CollapseAllCommand(OrmDiagram ormDiagram) {
+ this.ormDiagram = ormDiagram;
+ }
+
+ public void execute() {
+ elExpState = ormDiagram.getElementsExpState();
+ ormDiagram.collapseAll();
+ }
+
+ public void undo() {
+ ormDiagram.setElementsExpState(elExpState);
+ }
+
+ public boolean canUndo() {
+ return (elExpState != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ExpandAllCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ExpandAllCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ExpandAllCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.command;
+
+import java.util.HashMap;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ExpandAllCommand extends Command {
+
+ protected HashMap<String, Boolean> elExpState;
+ protected OrmDiagram ormDiagram;
+
+ public ExpandAllCommand(OrmDiagram ormDiagram) {
+ this.ormDiagram = ormDiagram;
+ }
+
+ public void execute() {
+ elExpState = ormDiagram.getElementsExpState();
+ ormDiagram.expandAll();
+ }
+
+ public void undo() {
+ ormDiagram.setElementsExpState(elExpState);
+ }
+
+ public boolean canUndo() {
+ return (elExpState != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleAssociationCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleAssociationCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleAssociationCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleAssociationCommand extends Command {
+
+ protected boolean stateConnectionsVisibilityAssociation;
+ protected DiagramViewer diagramViewer;
+
+ public ToggleAssociationCommand(DiagramViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ stateConnectionsVisibilityAssociation =
+ diagramViewer.getConnectionsVisibilityAssociation();
+ }
+
+ public void execute() {
+ stateConnectionsVisibilityAssociation =
+ diagramViewer.getConnectionsVisibilityAssociation();
+ diagramViewer.setConnectionsVisibilityAssociation(
+ !stateConnectionsVisibilityAssociation);
+ }
+
+ public void undo() {
+ diagramViewer.setConnectionsVisibilityAssociation(
+ stateConnectionsVisibilityAssociation);
+ }
+
+ public boolean canUndo() {
+ return (diagramViewer != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleClassMappingCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleClassMappingCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleClassMappingCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleClassMappingCommand extends Command {
+
+ protected boolean stateConnectionsVisibilityClassMapping;
+ protected DiagramViewer diagramViewer;
+
+ public ToggleClassMappingCommand(DiagramViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ stateConnectionsVisibilityClassMapping =
+ diagramViewer.getConnectionsVisibilityClassMapping();
+ }
+
+ public void execute() {
+ stateConnectionsVisibilityClassMapping =
+ diagramViewer.getConnectionsVisibilityClassMapping();
+ diagramViewer.setConnectionsVisibilityClassMapping(
+ !stateConnectionsVisibilityClassMapping);
+ }
+
+ public void undo() {
+ diagramViewer.setConnectionsVisibilityClassMapping(
+ stateConnectionsVisibilityClassMapping);
+ }
+
+ public boolean canUndo() {
+ return (diagramViewer != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleConnectionsCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleConnectionsCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleConnectionsCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleConnectionsCommand extends Command {
+
+ protected boolean stateConnectionsVisibilityAssociation;
+ protected boolean stateConnectionsVisibilityClassMapping;
+ protected boolean stateConnectionsVisibilityForeignKeyConstraint;
+ protected boolean stateConnectionsVisibilityPropertyMapping;
+ protected DiagramViewer diagramViewer;
+
+ public ToggleConnectionsCommand(DiagramViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ stateConnectionsVisibilityAssociation =
+ diagramViewer.getConnectionsVisibilityAssociation();
+ stateConnectionsVisibilityClassMapping =
+ diagramViewer.getConnectionsVisibilityClassMapping();
+ stateConnectionsVisibilityForeignKeyConstraint =
+ diagramViewer.getConnectionsVisibilityForeignKeyConstraint();
+ stateConnectionsVisibilityPropertyMapping =
+ diagramViewer.getConnectionsVisibilityPropertyMapping();
+ }
+
+ public void execute() {
+ stateConnectionsVisibilityAssociation =
+ diagramViewer.getConnectionsVisibilityAssociation();
+ diagramViewer.setConnectionsVisibilityAssociation(
+ !stateConnectionsVisibilityAssociation);
+ stateConnectionsVisibilityClassMapping =
+ diagramViewer.getConnectionsVisibilityClassMapping();
+ diagramViewer.setConnectionsVisibilityClassMapping(
+ !stateConnectionsVisibilityClassMapping);
+ stateConnectionsVisibilityForeignKeyConstraint =
+ diagramViewer.getConnectionsVisibilityForeignKeyConstraint();
+ diagramViewer.setConnectionsVisibilityForeignKeyConstraint(
+ !stateConnectionsVisibilityForeignKeyConstraint);
+ stateConnectionsVisibilityPropertyMapping =
+ diagramViewer.getConnectionsVisibilityPropertyMapping();
+ diagramViewer.setConnectionsVisibilityPropertyMapping(
+ !stateConnectionsVisibilityPropertyMapping);
+ }
+
+ public void undo() {
+ diagramViewer.setConnectionsVisibilityAssociation(
+ stateConnectionsVisibilityAssociation);
+ diagramViewer.setConnectionsVisibilityClassMapping(
+ stateConnectionsVisibilityClassMapping);
+ diagramViewer.setConnectionsVisibilityForeignKeyConstraint(
+ stateConnectionsVisibilityForeignKeyConstraint);
+ diagramViewer.setConnectionsVisibilityPropertyMapping(
+ stateConnectionsVisibilityPropertyMapping);
+ }
+
+ public boolean canUndo() {
+ return (diagramViewer != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleForeignKeyConstraintCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleForeignKeyConstraintCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleForeignKeyConstraintCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleForeignKeyConstraintCommand extends Command {
+
+ protected boolean stateConnectionsVisibilityForeignKeyConstraint;
+ protected DiagramViewer diagramViewer;
+
+ public ToggleForeignKeyConstraintCommand(DiagramViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ stateConnectionsVisibilityForeignKeyConstraint =
+ diagramViewer.getConnectionsVisibilityForeignKeyConstraint();
+ }
+
+ public void execute() {
+ stateConnectionsVisibilityForeignKeyConstraint =
+ diagramViewer.getConnectionsVisibilityForeignKeyConstraint();
+ diagramViewer.setConnectionsVisibilityForeignKeyConstraint(
+ !stateConnectionsVisibilityForeignKeyConstraint);
+ }
+
+ public void undo() {
+ diagramViewer.setConnectionsVisibilityForeignKeyConstraint(
+ stateConnectionsVisibilityForeignKeyConstraint);
+ }
+
+ public boolean canUndo() {
+ return (diagramViewer != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/TogglePropertyMappingCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/TogglePropertyMappingCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/TogglePropertyMappingCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.command;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class TogglePropertyMappingCommand extends Command {
+
+ protected boolean stateConnectionsVisibilityPropertyMapping;
+ protected DiagramViewer diagramViewer;
+
+ public TogglePropertyMappingCommand(DiagramViewer diagramViewer) {
+ this.diagramViewer = diagramViewer;
+ stateConnectionsVisibilityPropertyMapping =
+ diagramViewer.getConnectionsVisibilityPropertyMapping();
+ }
+
+ public void execute() {
+ stateConnectionsVisibilityPropertyMapping =
+ diagramViewer.getConnectionsVisibilityPropertyMapping();
+ diagramViewer.setConnectionsVisibilityPropertyMapping(
+ !stateConnectionsVisibilityPropertyMapping);
+ }
+
+ public void undo() {
+ diagramViewer.setConnectionsVisibilityPropertyMapping(
+ stateConnectionsVisibilityPropertyMapping);
+ }
+
+ public boolean canUndo() {
+ return (diagramViewer != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeExpandStateCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeExpandStateCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeExpandStateCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.command;
+
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandableShape;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleShapeExpandStateCommand extends Command {
+
+ protected List<ExpandableShape> selectedShape;
+
+ public ToggleShapeExpandStateCommand(List<ExpandableShape> selectedShape) {
+ this.selectedShape = selectedShape;
+ }
+
+ public void execute() {
+ for (ExpandableShape shape : selectedShape) {
+ shape.setExpanded(!shape.isExpanded());
+ }
+ }
+
+ public void undo() {
+ for (ExpandableShape shape : selectedShape) {
+ shape.setExpanded(!shape.isExpanded());
+ }
+ }
+
+ public boolean canUndo() {
+ return (selectedShape != null);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeVisibleStateCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeVisibleStateCommand.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ToggleShapeVisibleStateCommand.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.command;
+
+import java.util.List;
+
+import org.eclipse.gef.commands.Command;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
+
+/**
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ToggleShapeVisibleStateCommand extends Command {
+
+ protected List<OrmShape> selectedShape;
+
+ public ToggleShapeVisibleStateCommand(List<OrmShape> selectedShape) {
+ this.selectedShape = selectedShape;
+ }
+
+ public void execute() {
+ for (OrmShape shape : selectedShape) {
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof PersistentClass || ormElement instanceof Table) {
+ shape.setVisible(!shape.isVisible());
+ }
+ }
+ }
+
+ public void undo() {
+ for (OrmShape shape : selectedShape) {
+ Object ormElement = shape.getOrmElement();
+ if (ormElement instanceof PersistentClass || ormElement instanceof Table) {
+ shape.setVisible(!shape.isVisible());
+ }
+ }
+ }
+
+ public boolean canUndo() {
+ return (selectedShape != null);
+ }
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-10-13 13:51:59 UTC (rev 18067)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-10-13 14:31:24 UTC (rev 18068)
@@ -26,6 +26,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
+import java.util.Map.Entry;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -33,6 +34,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;
@@ -821,4 +823,40 @@
public void setMemento(IMemento memento) {
this.memento = memento;
}
+
+ public HashMap<String, Point> getElementsLocations() {
+ HashMap<String, Point> elLocations = new HashMap<String, Point>();
+ Iterator< Entry<String, OrmShape> > it = elements.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, OrmShape> entry = it.next();
+ elLocations.put(entry.getKey(), entry.getValue().getLocation());
+ }
+ return elLocations;
+ }
+
+ public void setElementsLocations(HashMap<String, Point> elLocations) {
+ Iterator< Entry<String, Point> > it = elLocations.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, Point> entry = it.next();
+ elements.get(entry.getKey()).setLocation(entry.getValue());
+ }
+ }
+
+ public HashMap<String, Boolean> getElementsExpState() {
+ HashMap<String, Boolean> elExpState = new HashMap<String, Boolean>();
+ Iterator< Entry<String, OrmShape> > it = elements.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, OrmShape> entry = it.next();
+ elExpState.put(entry.getKey(), entry.getValue().isExpanded());
+ }
+ return elExpState;
+ }
+
+ public void setElementsExpState(HashMap<String, Boolean> elExpState) {
+ Iterator< Entry<String, Boolean> > it = elExpState.entrySet().iterator();
+ while (it.hasNext()) {
+ Entry<String, Boolean> entry = it.next();
+ elements.get(entry.getKey()).setExpanded(entry.getValue());
+ }
+ }
}
14 years, 12 months
JBoss Tools SVN: r18067 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-10-13 09:51:59 -0400 (Tue, 13 Oct 2009)
New Revision: 18067
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4872
String class name constants changed to <Class>.class.getName()
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-13 13:35:52 UTC (rev 18066)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-13 13:51:59 UTC (rev 18067)
@@ -14,6 +14,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
@@ -49,7 +50,6 @@
import org.hibernate.mapping.Column;
import org.hibernate.mapping.IndexedCollection;
import org.hibernate.mapping.JoinedSubclass;
-import org.hibernate.mapping.List;
import org.hibernate.mapping.ManyToOne;
import org.hibernate.mapping.OneToMany;
import org.hibernate.mapping.OneToOne;
@@ -445,7 +445,7 @@
cValue.setElement(elementValue);
cValue.setCollectionTable(rootClass.getTable());//TODO what to set?
}
- if (value instanceof List){
+ if (value instanceof org.hibernate.mapping.List){
((IndexedCollection)cValue).setIndex(new SimpleValue());
} else if (value instanceof org.hibernate.mapping.Map){
SimpleValue map_key = new SimpleValue();
@@ -489,7 +489,7 @@
((org.hibernate.mapping.Collection) value).setElement(element);
((org.hibernate.mapping.Collection) value).setCollectionTable(rootClass.getTable());//TODO what to set?
buildProperty(value);
- if (value instanceof List){
+ if (value instanceof org.hibernate.mapping.List){
((IndexedCollection)value).setIndex(new SimpleValue());
} else if (value instanceof org.hibernate.mapping.Map){
SimpleValue map_key = new SimpleValue();
@@ -549,13 +549,13 @@
private org.hibernate.mapping.Collection buildCollectionValue(ITypeBinding[] interfaces){
org.hibernate.mapping.Collection cValue = null;
- if (Utils.isImplementInterface(interfaces, "java.util.Set")){//$NON-NLS-1$
+ if (Utils.isImplementInterface(interfaces, Set.class.getName())){
cValue = new org.hibernate.mapping.Set(rootClass);
- } else if (Utils.isImplementInterface(interfaces, "java.util.List")){//$NON-NLS-1$
- cValue = new org.hibernate.mapping.List(rootClass);
- } else if (Utils.isImplementInterface(interfaces, "java.util.Map")){//$NON-NLS-1$
+ } else if (Utils.isImplementInterface(interfaces, List.class.getName())){
+ cValue = new org.hibernate.mapping.List(rootClass);
+ } else if (Utils.isImplementInterface(interfaces, Map.class.getName())){
cValue = new org.hibernate.mapping.Map(rootClass);
- } else if (Utils.isImplementInterface(interfaces, "java.util.Collection")){//$NON-NLS-1$
+ } else if (Utils.isImplementInterface(interfaces, Collection.class.getName())){
cValue = new org.hibernate.mapping.Bag(rootClass);
}
14 years, 12 months
JBoss Tools SVN: r18066 - in trunk/documentation/qa/docs/Test_Cases: Test_Projects and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: anis
Date: 2009-10-13 09:35:52 -0400 (Tue, 13 Oct 2009)
New Revision: 18066
Added:
trunk/documentation/qa/docs/Test_Cases/CAverification.doc
Removed:
trunk/documentation/qa/docs/Test_Cases/Test_Projects/CAverification.doc
Log:
Wrong folder
Copied: trunk/documentation/qa/docs/Test_Cases/CAverification.doc (from rev 18065, trunk/documentation/qa/docs/Test_Cases/Test_Projects/CAverification.doc)
===================================================================
(Binary files differ)
Deleted: trunk/documentation/qa/docs/Test_Cases/Test_Projects/CAverification.doc
===================================================================
(Binary files differ)
14 years, 12 months
JBoss Tools SVN: r18065 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui: wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-10-13 09:10:53 -0400 (Tue, 13 Oct 2009)
New Revision: 18065
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/AddRemoveTableComposite.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4872
updated ui
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2009-10-13 13:00:09 UTC (rev 18064)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.java 2009-10-13 13:10:53 UTC (rev 18065)
@@ -35,6 +35,14 @@
public static String ResolveAmbiguous_column_Owner;
public static String ResolveAmbiguous_empty;
public static String ResolveAmbiguous_message;
+ public static String AddRemoveTableComposite_add_class;
+ public static String AddRemoveTableComposite_add_package;
+ public static String AddRemoveTableComposite_java_types_title;
+ public static String AddRemoveTableComposite_java_packages_title;
+ public static String AddRemoveTableComposite_java_select_types;
+ public static String AddRemoveTableComposite_java_select_packages;
+ public static String NewHibernateMappingElementsSelectionPage2_description;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, JdtUiMessages.class);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2009-10-13 13:00:09 UTC (rev 18064)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/internal/JdtUiMessages.properties 2009-10-13 13:10:53 UTC (rev 18065)
@@ -39,3 +39,10 @@
ResolveAmbiguous_column_Owner=Owner
ResolveAmbiguous_empty=<empty>
ResolveAmbiguous_message=Edit entities relations.
+AddRemoveTableComposite_add_class=Add Class...
+AddRemoveTableComposite_add_package=Add Package...
+AddRemoveTableComposite_java_types_title=Java Types
+AddRemoveTableComposite_java_packages_title=Packages
+AddRemoveTableComposite_java_select_types=Select types to be mapped
+AddRemoveTableComposite_java_select_packages=Select packages to search for java types
+NewHibernateMappingElementsSelectionPage2_description=Add classes and packages to create mapping files for
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/AddRemoveTableComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/AddRemoveTableComposite.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/AddRemoveTableComposite.java 2009-10-13 13:10:53 UTC (rev 18065)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 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.hibernate.eclipse.jdt.ui.wizards;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.hibernate.eclipse.console.wizards.UpDownListComposite;
+import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class AddRemoveTableComposite extends UpDownListComposite {
+
+ public AddRemoveTableComposite(Composite parent, int style) {
+ super(parent, style, "", //$NON-NLS-1$
+ false, new JavaElementLabelProvider(),
+ ArrayContentProvider.getInstance());
+ setUpDownVisible(false);
+ }
+
+ @Override
+ protected String[] getAddButtonLabels() {
+ return new String[] { JdtUiMessages.AddRemoveTableComposite_add_class,
+ JdtUiMessages.AddRemoveTableComposite_add_package};
+ }
+
+ protected void createColumns(Table table) {
+ TableColumn column = new TableColumn(table, SWT.NULL);
+ column.setWidth(350);
+ }
+
+ protected Object[] handleAdd(int i) {
+
+ SelectionDialog dialog= null;
+ try {
+ IJavaProject[] projects = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProjects();
+
+ int includeMask = IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS;
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(projects, includeMask);
+
+ if (i == 0){
+ dialog=
+ JavaUI.createTypeDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ scope,
+ IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES,
+ true);
+ dialog.setTitle(JdtUiMessages.AddRemoveTableComposite_java_types_title);
+ dialog.setMessage(JdtUiMessages.AddRemoveTableComposite_java_select_types);
+ } else if (i == 1){
+ dialog=
+ JavaUI.createPackageDialog(
+ getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ scope,
+ true,
+ true,
+ null);
+ dialog.setTitle(JdtUiMessages.AddRemoveTableComposite_java_packages_title);
+ dialog.setMessage(JdtUiMessages.AddRemoveTableComposite_java_select_packages);
+ } else {
+ return null;
+ }
+
+
+ if (dialog.open() == IDialogConstants.CANCEL_ID)
+ return null;
+
+ return dialog.getResult();
+ } catch (JavaModelException jme) {
+ return null;
+ }
+ }
+
+
+
+}
+
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/AddRemoveTableComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java 2009-10-13 13:10:53 UTC (rev 18065)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 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.hibernate.eclipse.jdt.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableItem;
+import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class NewHibernateMappingElementsSelectionPage2 extends WizardPage {
+
+ AddRemoveTableComposite addRemoveTableComposite;
+
+ private IStructuredSelection selection;
+
+ public NewHibernateMappingElementsSelectionPage2(String pageName, IStructuredSelection selection) {
+ super(pageName);
+ this.selection = selection;
+ setDescription(JdtUiMessages.NewHibernateMappingElementsSelectionPage2_description);
+ }
+
+ public void createControl(Composite parent) {
+ addRemoveTableComposite = new AddRemoveTableComposite(parent, SWT.NONE);
+ addRemoveTableComposite.getTableViewer().setInput(selection.toArray());
+ setControl(addRemoveTableComposite);
+ }
+
+ public IStructuredSelection getSelection(){
+ TableItem[] items = addRemoveTableComposite.getTableViewer().getTable().getItems();
+ Object[] data = new Object[items.length];
+ for (int i = 0; i < items.length; i++) {
+ data[i] = items[i].getData();
+ }
+ return new StructuredSelection(data);
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-10-13 13:00:09 UTC (rev 18064)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-10-13 13:10:53 UTC (rev 18065)
@@ -164,6 +164,7 @@
private class TableContentProvider implements IStructuredContentProvider {
+ @SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
if (inputElement instanceof Map) {
List<TableLine> result = new ArrayList<TableLine>();
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-10-13 13:00:09 UTC (rev 18064)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-10-13 13:10:53 UTC (rev 18065)
@@ -11,6 +11,7 @@
package org.hibernate.eclipse.jdt.ui.wizards;
import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -27,6 +28,8 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IParent;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.JavaElementInfo;
@@ -37,6 +40,7 @@
import org.eclipse.jface.dialogs.PageChangingEvent;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
@@ -67,24 +71,31 @@
private Map<IJavaProject, Collection<EntityInfo>> project_infos = new HashMap<IJavaProject, Collection<EntityInfo>>();
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
+
+ private NewHibernateMappingElementsSelectionPage2 page0 = null;
- private NewHibernateMappingElementsSelectionPage page1 = null;
+ //private NewHibernateMappingElementsSelectionPage page1 = null;
private NewHibernateMappingFilePage page2 = null;
public NewHibernateMappingFileWizard(){
setDefaultPageImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.NEW_WIZARD) );
setNeedsProgressMonitor(true);
+ setWindowTitle(HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file);
}
@Override
public void addPages() {
super.addPages();
- page1 = new NewHibernateMappingElementsSelectionPage(selection);
- page1.setTitle( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file );
- page1.setDescription( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_new_xml_mapping_file );
- addPage(page1);
+
+ page0 = new NewHibernateMappingElementsSelectionPage2(HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file, selection);
+ addPage(page0);
+
+ //page1 = new NewHibernateMappingElementsSelectionPage(selection);
+ //page1.setTitle( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file );
+ //page1.setDescription( HibernateConsoleMessages.NewHibernateMappingFileWizard_create_new_xml_mapping_file );
+ //addPage(page1);
page2 = new NewHibernateMappingFilePage();
addPage(page2);
}
@@ -102,13 +113,63 @@
public void handlePageChanging(PageChangingEvent event) {
if (event.getTargetPage() == page2){
- updateCompilationUnits();
- page2.setInput(project_infos);
+ updateCompilationUnits();
+ page2.setInput(project_infos);
}
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.selection = selection;
+ Set<IJavaElement> filteredElements = new HashSet<IJavaElement>();
+ Object[] elements = selection.toArray();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof JavaProject) {
+ JavaProject project = (JavaProject) elements[i];
+ try {
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ for (int j = 0; j < roots.length; j++) {
+ if (!roots[j].isArchive()){
+ IJavaElement[] rootChildren = roots[j].getChildren();
+ for (int k = 0; k < rootChildren.length; k++) {
+ if (rootChildren[k] instanceof IParent && ((IParent)rootChildren[k]).hasChildren()){
+ filteredElements.add(rootChildren[k]);
+ }
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ } else if (elements[i] instanceof IPackageFragmentRoot) {
+ IPackageFragmentRoot root = (IPackageFragmentRoot)elements[i];
+ if (!root.isArchive()){
+ try {
+ filteredElements.addAll(Arrays.asList((root.getChildren())));
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ }
+ } else if (elements[i] instanceof ICompilationUnit) {
+ ICompilationUnit cu = (ICompilationUnit)elements[i];
+ IType[] types;
+ try {
+ types = cu.getTypes();
+ //remove java extension.
+ String typeName = cu.getElementName().substring(0, cu.getElementName().length() - 5);
+ for (int j = 0; j < types.length; j++) {
+ if (types[j].getElementName().equals(typeName)){
+ filteredElements.add(types[j]);
+ break;
+ }
+ }
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+
+ } else if (elements[i] instanceof IJavaElement) {
+ filteredElements.add((IJavaElement) elements[i]);
+ }
+ }
+ this.selection = new StructuredSelection(filteredElements.toArray());
}
@Override
@@ -227,11 +288,11 @@
protected void updateCompilationUnits(){
- Assert.isNotNull(page1.getSelection(), HibernateConsoleMessages.NewHibernateMappingFileWizard_selection_cant_be_empty);
- if ((selectionCU == null) || !page1.getSelection().equals(selection)) {
+ Assert.isNotNull(page0.getSelection(), HibernateConsoleMessages.NewHibernateMappingFileWizard_selection_cant_be_empty);
+ if ((selectionCU == null) || !page0.getSelection().equals(selection)) {
selectionCU = new HashSet<ICompilationUnit>();
project_infos.clear();
- selection = page1.getSelection();
+ selection = page0.getSelection();
try {
getContainer().run(false, false, new IRunnableWithProgress() {
14 years, 12 months
JBoss Tools SVN: r18064 - trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-10-13 09:00:09 -0400 (Tue, 13 Oct 2009)
New Revision: 18064
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4872
Set collection table more precisely.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-13 12:57:07 UTC (rev 18063)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/ConfigurationActor.java 2009-10-13 13:00:09 UTC (rev 18064)
@@ -427,31 +427,33 @@
rootClass = rootClasses.get(entityInfo.getFullyQualifiedName());
Assert.isNotNull(rootClass, "RootClass not found."); //$NON-NLS-1$
- Value value = null;
- if (ref != null && rootClasses.get(ref.fullyQualifiedName) != null){
- RootClass associatedClass = rootClasses.get(ref.fullyQualifiedName);
- ITypeBinding[] interfaces = Utils.getAllInterfaces(tb);
- value = buildCollectionValue(interfaces);
- if (value != null) {
- org.hibernate.mapping.Collection cValue = (org.hibernate.mapping.Collection)value;
+ ITypeBinding[] interfaces = Utils.getAllInterfaces(tb);
+ Value value = buildCollectionValue(interfaces);
+ if (value != null) {
+ org.hibernate.mapping.Collection cValue = (org.hibernate.mapping.Collection)value;
+ if (ref != null && rootClasses.get(ref.fullyQualifiedName) != null){
OneToMany oValue = new OneToMany(rootClass);
+ RootClass associatedClass = rootClasses.get(ref.fullyQualifiedName);
oValue.setAssociatedClass(associatedClass);
oValue.setReferencedEntityName(ref.fullyQualifiedName);
//Set another table
- cValue.setCollectionTable(associatedClass.getTable());
-
- cValue.setElement(oValue);
-
- if (value instanceof List){
- ((IndexedCollection)cValue).setIndex(new SimpleValue());
- } else if (value instanceof org.hibernate.mapping.Map){
- SimpleValue map_key = new SimpleValue();
- //FIXME: is it possible to map Map<SourceType, String>?
- //Or only Map<String, SourceType>
- map_key.setTypeName(tb.getTypeArguments()[0].getBinaryName());
- ((IndexedCollection)cValue).setIndex(map_key);
- }
+ cValue.setCollectionTable(associatedClass.getTable());
+ cValue.setElement(oValue);
+ } else {
+ SimpleValue elementValue = buildSimpleValue(tb.getTypeArguments()[0].getQualifiedName());
+ elementValue.setTable(rootClass.getTable());
+ cValue.setElement(elementValue);
+ cValue.setCollectionTable(rootClass.getTable());//TODO what to set?
}
+ if (value instanceof List){
+ ((IndexedCollection)cValue).setIndex(new SimpleValue());
+ } else if (value instanceof org.hibernate.mapping.Map){
+ SimpleValue map_key = new SimpleValue();
+ //FIXME: is it possible to map Map<SourceType, String>?
+ //Or only Map<String, SourceType>
+ map_key.setTypeName(tb.getTypeArguments()[0].getBinaryName());
+ ((IndexedCollection)cValue).setIndex(map_key);
+ }
}
if (value == null) {
@@ -485,6 +487,7 @@
if (value != null){
SimpleValue element = buildSimpleValue("string");//$NON-NLS-1$
((org.hibernate.mapping.Collection) value).setElement(element);
+ ((org.hibernate.mapping.Collection) value).setCollectionTable(rootClass.getTable());//TODO what to set?
buildProperty(value);
if (value instanceof List){
((IndexedCollection)value).setIndex(new SimpleValue());
14 years, 12 months
JBoss Tools SVN: r18062 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: editor/mozilla and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-10-13 07:07:44 -0400 (Tue, 13 Oct 2009)
New Revision: 18062
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4968, VPE toolbar icon will be updated on Selection Bar closing.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-10-13 10:41:17 UTC (rev 18061)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2009-10-13 11:07:44 UTC (rev 18062)
@@ -2802,4 +2802,11 @@
return selectionManager;
}
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4968
+ * Updating VPE toolbar on selection bar changes.
+ */
+ public void updateVpeToolbar() {
+ visualEditor.updateShowSelectionBarItem(selectionBar.isVisible());
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-10-13 10:41:17 UTC (rev 18061)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-10-13 11:07:44 UTC (rev 18062)
@@ -1105,4 +1105,8 @@
rotateEditorsAction.setToolTipText(layoutNames.get(prefsOrientation));
}
}
+
+ public void updateShowSelectionBarItem(boolean checked) {
+ showSelectionBarAction.setChecked(checked);
+ }
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-10-13 10:41:17 UTC (rev 18061)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2009-10-13 11:07:44 UTC (rev 18062)
@@ -199,6 +199,13 @@
splitter.getParent().layout(true, true);
this.visible = visible;
+ /*
+ * https://jira.jboss.org/jira/browse/JBIDE-4968
+ * Updating VPE toolbar on selection bar changes.
+ */
+ if (vpeController != null) {
+ vpeController.updateVpeToolbar();
+ }
fireVisibilityListeners();
}
14 years, 12 months
JBoss Tools SVN: r18061 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor: dnd and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-13 06:41:17 -0400 (Tue, 13 Oct 2009)
New Revision: 18061
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4996
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-10-13 10:34:13 UTC (rev 18060)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-10-13 10:41:17 UTC (rev 18061)
@@ -94,6 +94,7 @@
import org.jboss.tools.common.model.XModelBuffer;
import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.XModelObjectConstants;
import org.jboss.tools.common.model.XModelTransferBuffer;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
@@ -125,6 +126,7 @@
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.editor.IVisualController;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.FileTagProposalLoader;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPTagProposalFactory;
import org.jboss.tools.jst.jsp.jspeditor.dnd.TagProposal;
@@ -856,10 +858,17 @@
public TagAttributesComposite.AttributeDescriptorValue[] createDescriptors(KbQuery query) {
IComponent s = findComponent(query);
if(s == null) return new TagAttributesComposite.AttributeDescriptorValue[0];
+ boolean excludeJSFC = false;
+ if(FileTagProposalLoader.FACELETS_URI.equals(query.getUri())) {
+ if(getModelObject() != null && "jsp".equalsIgnoreCase(getModelObject().getAttributeValue(XModelObjectConstants.ATTR_NAME_EXTENSION))) { //$NON-NLS-1$
+ excludeJSFC = true;
+ }
+ }
List<AttributeDescriptorValue> attributesValues = new ArrayList<AttributeDescriptorValue>();
IAttribute[] as = s.getAttributes();
for (IAttribute a: as) {
+ if(excludeJSFC && "jsfc".equals(a.getName())) continue; //$NON-NLS-1$
AttributeDescriptorValue value = new AttributeDescriptorValue(a.getName(), a.isRequired(), a.isPreferable());
attributesValues.add(value);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java 2009-10-13 10:34:13 UTC (rev 18060)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/CssLinkAttributeValueLoader.java 2009-10-13 10:41:17 UTC (rev 18061)
@@ -11,9 +11,12 @@
package org.jboss.tools.jst.jsp.jspeditor.dnd;
import org.jboss.tools.common.model.ui.editors.dnd.AbsoluteFilePathAttributeValueLoader;
+import org.jboss.tools.common.model.ui.editors.dnd.DefaultDropWizardModel;
import org.jboss.tools.common.model.ui.editors.dnd.IDropWizardModel;
public class CssLinkAttributeValueLoader extends AbsoluteFilePathAttributeValueLoader {
+ static String ATTR_REL = "rel"; //$NON-NLS-1$
+ static String ATTR_TYPE = "type"; //$NON-NLS-1$
public CssLinkAttributeValueLoader(String pathAttributeName) {
super(pathAttributeName, null, null);
@@ -21,8 +24,12 @@
public void fillTagAttributes(IDropWizardModel model) {
super.fillTagAttributes(model);
- model.setAttributeValue("rel", "stylesheet"); //$NON-NLS-1$ //$NON-NLS-2$
- model.setAttributeValue("type", "text/css"); //$NON-NLS-1$ //$NON-NLS-2$
+ model.setAttributeValue(ATTR_REL, "stylesheet"); //$NON-NLS-1$
+ model.setAttributeValue(ATTR_TYPE, "text/css"); //$NON-NLS-1$
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_REL);
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_TYPE);
+ }
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-13 10:34:13 UTC (rev 18060)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/FileTagProposalLoader.java 2009-10-13 10:41:17 UTC (rev 18061)
@@ -24,6 +24,8 @@
public class FileTagProposalLoader implements ITagProposalLoader {
+ public static String FACELETS_URI = "http://www.w3.org/1999/xhtml/facelets"; //$NON-NLS-1$
+
private static final Map<String,TagProposal[]> extensionMap = new HashMap<String,TagProposal[]>();
static TagProposal[] IMG_TAG_PROPOSALS = new TagProposal[]{
@@ -34,7 +36,8 @@
new AbsoluteFilePathAttributeValueLoader("value","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
),
new TagProposal(
- DropURI.HTML_4_0_URI,
+// DropURI.HTML_4_0_URI,
+ FACELETS_URI,
ITagProposal.EMPTY_PREFIX,
"img", //$NON-NLS-1$
new AbsoluteFilePathAttributeValueLoader("src","","") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
@@ -63,7 +66,8 @@
static TagProposal[] CSS_TAG_PROPOSALS = new TagProposal[]{
new TagProposal(
- DropURI.HTML_4_0_URI,
+// DropURI.HTML_4_0_URI,
+ FACELETS_URI,
ITagProposal.EMPTY_PREFIX,
"link", //$NON-NLS-1$
new CssLinkAttributeValueLoader("href") //$NON-NLS-1$
14 years, 12 months
JBoss Tools SVN: r18060 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-13 06:34:13 -0400 (Tue, 13 Oct 2009)
New Revision: 18060
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
Log:
print removed
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2009-10-13 10:33:24 UTC (rev 18059)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/ObjectMultiPageEditor.java 2009-10-13 10:34:13 UTC (rev 18060)
@@ -503,7 +503,7 @@
}
if(event.getDetails() == XModelTreeEvent.AFTER_MERGE && event.getModelObject() == getModelObject()) {
waitForMerge = false;
- System.out.println("waitingEventsCount=" + waitingEventsCount);
+// System.out.println("waitingEventsCount=" + waitingEventsCount);
waitingEventsCount = 0;
}
waitingEventsCount++;
14 years, 12 months
JBoss Tools SVN: r18059 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd: composite and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-13 06:33:24 -0400 (Tue, 13 Oct 2009)
New Revision: 18059
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4996
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java 2009-10-13 09:25:08 UTC (rev 18058)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/AbsoluteFilePathAttributeValueLoader.java 2009-10-13 10:33:24 UTC (rev 18059)
@@ -63,6 +63,9 @@
String v = (input == null) ? null : dropFileToFile(file, input.getFile(), model);
if(v == null) v = "/"+filePath.toString(); //$NON-NLS-1$
model.setAttributeValue(fPathAttributeName, v);
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(fPathAttributeName);
+ }
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-13 09:25:08 UTC (rev 18058)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DefaultDropWizardModel.java 2009-10-13 10:33:24 UTC (rev 18059)
@@ -60,17 +60,27 @@
*/
public void setAttributeValue(String name, Object value) {
if(name==null) throw new IllegalArgumentException("Attribute name cannot be null"); //$NON-NLS-1$
- AttributeDescriptorValue descrValue = null;
+ AttributeDescriptorValue descrValue = findDescriptor(name);
+ if(descrValue==null) throw new IllegalArgumentException("Attribute '" + name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
+ descrValue.setValue(value);
+ fireModelChaged(ATTRIBUTE_VALUE,null,descrValue);
+ }
+
+ public void setPreferable(String name) {
+ if(name==null) return;
+ AttributeDescriptorValue descrValue = findDescriptor(name);
+ if(descrValue != null) descrValue.setPreferable(true);
+ }
+
+ private AttributeDescriptorValue findDescriptor(String name) {
for (int i = 0; i < fAttributeValues.size(); i++) {
AttributeDescriptorValue arrayElement = (AttributeDescriptorValue)fAttributeValues.get(i);
if(name.equals(arrayElement.getName())) {
- descrValue = arrayElement;
+ return arrayElement;
}
}
- if(descrValue==null) throw new IllegalArgumentException("Attribute '" + name + "' not found"); //$NON-NLS-1$ //$NON-NLS-2$
- descrValue.setValue(value);
- fireModelChaged(ATTRIBUTE_VALUE,null,descrValue);
- }
+ return null;
+ }
/**
*
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java 2009-10-13 09:25:08 UTC (rev 18058)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/LoadBundleBaseNameAttributeValueLoader.java 2009-10-13 10:33:24 UTC (rev 18059)
@@ -21,9 +21,9 @@
*
* @author eskimo
*/
-public class LoadBundleBaseNameAttributeValueLoader
- implements
- IAttributeValueLoader {
+public class LoadBundleBaseNameAttributeValueLoader implements IAttributeValueLoader {
+ static String ATTR_BASENAME = "basename"; //$NON-NLS-1$
+ static String ATTR_VAR = "var"; //$NON-NLS-1$
public void fillTagAttributes(IDropWizardModel model) {
String baseName = ""; //$NON-NLS-1$
@@ -69,8 +69,12 @@
}
// TODO Eskimo - Think about how reject drop id properties file is not under java source
- model.setAttributeValue("basename", baseName); //$NON-NLS-1$
- model.setAttributeValue("var", fileName.toLowerCase()); //$NON-NLS-1$
+ model.setAttributeValue(ATTR_BASENAME, baseName);
+ model.setAttributeValue(ATTR_VAR, fileName.toLowerCase());
+ if(model instanceof DefaultDropWizardModel) {
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_BASENAME);
+ ((DefaultDropWizardModel)model).setPreferable(ATTR_VAR);
+ }
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-10-13 09:25:08 UTC (rev 18058)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/TagAttributesWizardPage.java 2009-10-13 10:33:24 UTC (rev 18059)
@@ -139,7 +139,7 @@
protected boolean showAdvansedTab() {
AttributeDescriptorValue[] values = getDropWizardModel().getAttributeValueDescriptors();
for(int i=0;i<values.length;i++) {
- if(values[i].isRequired() || values[i].isRequired()) {
+ if(values[i].isPreferable() || values[i].isRequired()) {
return true;
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-10-13 09:25:08 UTC (rev 18058)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/composite/TagAttributesComposite.java 2009-10-13 10:33:24 UTC (rev 18059)
@@ -111,6 +111,9 @@
return isPreferable;
}
+ public void setPreferable(boolean b) {
+ isPreferable = b;
+ }
/**
*
*/
@@ -416,4 +419,5 @@
public void widgetDefaultSelected(SelectionEvent e) {
}
+
}
14 years, 12 months