JBoss Tools SVN: r34045 - trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-18 08:32:50 -0400 (Thu, 18 Aug 2011)
New Revision: 34045
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF
Log:
[JBIDE-9513] implemented push to (preconfigured) remote repo. Missing: choose remote repo among several available ones & tests are also missing yet
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF 2011-08-18 12:32:16 UTC (rev 34044)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF 2011-08-18 12:32:50 UTC (rev 34045)
@@ -12,7 +12,7 @@
org.eclipse.team.core;bundle-version="[3.6.0,4.0.0)",
org.eclipse.wst.server.core;bundle-version="[1.1.302,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.7.100,4.0.0)",
- org.eclipse.core.runtime
+ org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: JBoss by Red Hat
14 years, 8 months
JBoss Tools SVN: r34044 - in trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core: internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-18 08:32:16 -0400 (Thu, 18 Aug 2011)
New Revision: 34044
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitBehaviourDelegate.java
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
Log:
[JBIDE-9513] implemented push to (preconfigured) remote repo. Missing: choose remote repo among several available ones & tests are also missing yet
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitBehaviourDelegate.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitBehaviourDelegate.java 2011-08-18 12:31:23 UTC (rev 34043)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitBehaviourDelegate.java 2011-08-18 12:32:16 UTC (rev 34044)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.egit.core;
import org.eclipse.core.runtime.CoreException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitPublisher.java 2011-08-18 12:31:23 UTC (rev 34043)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitPublisher.java 2011-08-18 12:32:16 UTC (rev 34044)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.egit.core;
import org.eclipse.core.runtime.CoreException;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-08-18 12:31:23 UTC (rev 34043)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-08-18 12:32:16 UTC (rev 34044)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.egit.core.internal;
import org.osgi.framework.BundleActivator;
14 years, 8 months
JBoss Tools SVN: r34043 - trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-18 08:31:23 -0400 (Thu, 18 Aug 2011)
New Revision: 34043
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
Log:
[JBIDE-9513] implemented push to (preconfigured) remote repo. Missing: choose remote repo among several available ones & tests are also missing yet
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-18 12:10:35 UTC (rev 34042)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-18 12:31:23 UTC (rev 34043)
@@ -37,37 +37,31 @@
import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.as.egit.core.internal.EGitCoreActivator;
-// TODO: Auto-generated Javadoc
/**
* The Class EgitUtils.
- *
+ *
* @author André Dietisheim
*/
public class EgitUtils {
- /** The Constant DEFAULT_PUSH_REF_SPEC. */
private static final RefSpec DEFAULT_PUSH_REF_SPEC =
new RefSpec("refs/heads/*:refs/heads/*"); //$NON-NLS-1$
- /** The Constant PUSH_TIMEOUT. */
private static final int PUSH_TIMEOUT = 10 * 1024;
- /**
- * Commit.
- *
- * @param project the project
- * @throws CoreException the core exception
- */
public static void commit(IProject project) throws CoreException {
commit(project, null);
}
/**
* Commits the given project to it's configured repository.
- *
- * @param project the project
- * @param monitor the monitor
- * @throws CoreException the core exception
+ *
+ * @param project
+ * the project
+ * @param monitor
+ * the monitor
+ * @throws CoreException
+ * the core exception
*/
public static void commit(IProject project, IProgressMonitor monitor) throws CoreException {
/**
@@ -76,9 +70,9 @@
Repository repository = getRepository(project);
UserConfig userConfig = getUserConfig(repository);
CommitOperation op = new CommitOperation(
- null,
null,
null,
+ null,
getSubject(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
getSubject(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
"Initial commit");
@@ -87,13 +81,6 @@
op.execute(monitor);
}
- /**
- * Push.
- *
- * @param project the project
- * @param monitor the monitor
- * @throws CoreException the core exception
- */
public static void push(IProject project, IProgressMonitor monitor)
throws CoreException {
push(getRepository(project), monitor);
@@ -101,10 +88,13 @@
/**
* Pushes the given repository to it's configured remote.
- *
- * @param repository the source repository
- * @param monitor the monitor
- * @throws CoreException the core exception
+ *
+ * @param repository
+ * the source repository
+ * @param monitor
+ * the monitor
+ * @throws CoreException
+ * the core exception
*/
public static void push(Repository repository, IProgressMonitor monitor)
throws CoreException {
@@ -124,25 +114,10 @@
}
}
- /**
- * Creates the push operation.
- *
- * @param remoteName the remote name
- * @param repository the repository
- * @return the push operation
- */
private static PushOperation createPushOperation(String remoteName, Repository repository) {
return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
}
- /**
- * Creates the push operation.
- *
- * @param repository the repository
- * @param remoteConfig the remote config
- * @return the push operation
- * @throws CoreException the core exception
- */
private static PushOperation createPushOperation(Repository repository, RemoteConfig remoteConfig)
throws CoreException {
@@ -155,13 +130,18 @@
}
/**
- * Adds the uri ref to push specification.
- *
- * @param urisToPush the uris to push
- * @param pushRefSpecs the push ref specs
- * @param repository the repository
- * @param spec the spec
- * @throws CoreException the core exception
+ * Adds the given push uris to the given push operation specification.
+ *
+ * @param urisToPush
+ * the uris to push
+ * @param pushRefSpecs
+ * the push ref specs
+ * @param repository
+ * the repository
+ * @param spec
+ * the spec
+ * @throws CoreException
+ * the core exception
*/
private static void addURIRefToPushSpecification(List<URIish> urisToPush, List<RefSpec> pushRefSpecs,
Repository repository, PushOperationSpecification spec) throws CoreException {
@@ -184,9 +164,10 @@
}
/**
- * Gets the push ur is.
- *
- * @param remoteConfig the remote config
+ * Gets the push uris from the given remoteConfig.
+ *
+ * @param remoteConfig
+ * the remote config
* @return the push ur is
*/
private static List<URIish> getPushURIs(RemoteConfig remoteConfig) {
@@ -199,9 +180,10 @@
}
/**
- * Gets the push ref specs.
- *
- * @param config the config
+ * Gets the push RefSpecs from the given remote configuration.
+ *
+ * @param config
+ * the config
* @return the push ref specs
*/
private static List<RefSpec> getPushRefSpecs(RemoteConfig config) {
@@ -215,9 +197,10 @@
}
/**
- * Gets the repository.
- *
- * @param project the project
+ * Gets the repository that is configured to the given project.
+ *
+ * @param project
+ * the project
* @return the repository
*/
private static Repository getRepository(IProject project) {
@@ -229,29 +212,23 @@
}
/**
- * Gets the user config.
- *
- * @param repository the repository
+ * Gets the UserConfig from the given repository
+ *
+ * @param repository
+ * the repository
* @return the user config
*/
private static UserConfig getUserConfig(Repository repository) {
return repository.getConfig().get(UserConfig.KEY);
}
- /**
- * Gets the subject.
- *
- * @param name the name
- * @param email the email
- * @return the subject
- */
private static String getSubject(String name, String email) {
return new StringBuilder().append(name).append(" <").append(email).append('>').toString();
}
/**
- * Returns the configuration of the configured remote repository for a given
- * repository. Returns
+ * Returns the configuration of the remote repository that is set to the
+ * given repository. Returns
* <code>null</null> if none was configured or if there's no remote repo configured.
*
* @param repository
@@ -276,10 +253,13 @@
}
/**
- * Gets the remote config.
- *
- * @param remoteName the remote name
- * @param remoteRepositories the remote repositories
+ * Gets the remote config with the given name from the list of remote
+ * repositories.
+ *
+ * @param remoteName
+ * the remote name
+ * @param remoteRepositories
+ * the remote repositories
* @return the remote config
*/
private static RemoteConfig getRemoteConfig(String remoteName, List<RemoteConfig> remoteRepositories) {
@@ -299,9 +279,10 @@
}
/**
- * Gets the remote configs.
- *
- * @param repository the repository
+ * Gets the remote configs from the given repository.
+ *
+ * @param repository
+ * the repository
* @return the remote configs
*/
private static List<RemoteConfig> getRemoteConfigs(Repository repository) {
@@ -316,14 +297,16 @@
}
/**
- * Gets the remote name.
- *
- * @param repository the repository
- * @param branch the branch
+ * Gets the name of the remote repository for a given repository and branch.
+ *
+ * @param repository
+ * the repository
+ * @param branch
+ * the branch
* @return the remote name
*/
private static String getRemoteName(Repository repository, String branch) {
- String remoteName;
+ String remoteName = null;
if (ObjectId.isId(branch)) {
remoteName = Constants.DEFAULT_REMOTE_NAME;
} else {
@@ -333,5 +316,4 @@
}
return remoteName;
}
-
}
14 years, 8 months
JBoss Tools SVN: r34042 - in trunk/hibernatetools/plugins: org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/details/java and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-08-18 08:10:35 -0400 (Thu, 18 Aug 2011)
New Revision: 34042
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GenericGeneratorsComposite.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateGeneratorContainer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/details/java/HibernateJavaEntityComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/jpa2/details/java/HibernateJavaEntity2_0Composite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateGenerationComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateIdMappingComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
Log:
https://issues.jboss.org/browse/JBIDE-9560
create ui for @GenericGenerators
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateGeneratorContainer.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateGeneratorContainer.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateGeneratorContainer.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 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.jpt.core.internal.context;
import java.util.ListIterator;
@@ -4,6 +15,13 @@
import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
+/**
+ * @author Dmitry Geraskov
+ *
+ * Extends GeneratorContainer with possibility to hold
+ * org.hibernate.annotations.GenericGenerator(s)
+ * Used by entities, package-infos and ID mappings.
+ */
public interface HibernateGeneratorContainer extends GeneratorContainer {
//******************** generic generator *****************
@@ -27,6 +45,11 @@
GenericGenerator addGenericGenerator(int index);
/**
+ * Add a generic generator to the entity return the object representing it.
+ */
+ GenericGenerator addGenericGenerator();
+
+ /**
* Remove the generic generator at the index from the entity.
*/
void removeGenericGenerator(int index);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/details/java/HibernateJavaEntityComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/details/java/HibernateJavaEntityComposite.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/details/java/HibernateJavaEntityComposite.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 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,
@@ -92,7 +92,7 @@
@SuppressWarnings("unchecked")
@Override
protected void initializeGeneratorsSection(Composite container, PropertyValueModel<GeneratorContainer> generatorContainerHolder) {
- new HibernateGenerationComposite(this, (PropertyValueModel<? extends HibernateGeneratorContainer>) generatorContainerHolder, addSubPane(container, 10), true);
+ new HibernateGenerationComposite(this, (PropertyValueModel<? extends HibernateGeneratorContainer>) generatorContainerHolder, addSubPane(container, 10));
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/jpa2/details/java/HibernateJavaEntity2_0Composite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/jpa2/details/java/HibernateJavaEntity2_0Composite.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/jpa2/details/java/HibernateJavaEntity2_0Composite.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 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,
@@ -99,7 +99,7 @@
@SuppressWarnings("unchecked")
@Override
protected void initializeGeneratorsSection(Composite container, PropertyValueModel<GeneratorContainer> generatorContainerHolder) {
- new HibernateGenerationComposite(this, (PropertyValueModel<? extends HibernateGeneratorContainer>) generatorContainerHolder, addSubPane(container, 10), true);
+ new HibernateGenerationComposite(this, (PropertyValueModel<? extends HibernateGeneratorContainer>) generatorContainerHolder, addSubPane(container, 10));
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GenericGeneratorsComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GenericGeneratorsComposite.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GenericGeneratorsComposite.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -0,0 +1,236 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jpt.ui.internal.mapping.details;
+
+import java.util.ListIterator;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher;
+import org.eclipse.jpt.common.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.common.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.common.ui.internal.widgets.NewNameDialog;
+import org.eclipse.jpt.common.ui.internal.widgets.NewNameDialogBuilder;
+import org.eclipse.jpt.common.ui.internal.widgets.Pane;
+import org.eclipse.jpt.common.utility.internal.CollectionTools;
+import org.eclipse.jpt.common.utility.internal.Transformer;
+import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel;
+import org.eclipse.jpt.common.utility.model.value.ListValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.jpa.ui.internal.details.GeneratorComposite.GeneratorBuilder;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.PageBook;
+import org.jboss.tools.hibernate.jpt.core.internal.context.GenericGenerator;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateGeneratorContainer;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaGeneratorContainer;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaGenericGenerator;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class GenericGeneratorsComposite extends Pane<HibernateGeneratorContainer> {
+
+ private AddRemoveListPane<HibernateGeneratorContainer> listPane;
+ Pane<? extends GenericGenerator> genericGeneratorPane;
+ private WritablePropertyValueModel<GenericGenerator> generatorHolder;
+ private NewNameDialogBuilder dialogBuilder = null;
+
+ public GenericGeneratorsComposite(
+ Pane<?> parentPane,
+ PropertyValueModel<? extends HibernateGeneratorContainer> subjectHolder,
+ Composite parent) {
+ super(parentPane, subjectHolder, parent, false);
+ dialogBuilder = new NewNameDialogBuilder(getShell());
+ dialogBuilder.setDialogTitle(HibernateUIMappingMessages.GenericGeneratorsComposite_dialogTitle);
+ dialogBuilder.setDescriptionTitle(HibernateUIMappingMessages.GenericGeneratorsComposite_DescriptionTitle);
+ dialogBuilder.setDescription(HibernateUIMappingMessages.GenericGeneratorsComposite_Description);
+ dialogBuilder.setLabelText(HibernateUIMappingMessages.GenericGeneratorsComposite_Name);
+ }
+
+ void addGenericGenerator() {
+ addGenericGeneratorFromDialog(buildAddGenericGeneratorDialog());
+ }
+
+ protected HibernatePersistenceUnit getPersistenceUnit(){
+ return (HibernatePersistenceUnit)this.getSubject().getPersistenceUnit();
+ }
+
+ protected NewNameDialog buildAddGenericGeneratorDialog() {
+ dialogBuilder.setExistingNames(getPersistenceUnit().getUniqueGeneratorNames().iterator());
+ return dialogBuilder.buildDialog();
+ }
+
+ protected void addGenericGeneratorFromDialog(NewNameDialog dialog) {
+ if (dialog.open() != Window.OK) {
+ return;
+ }
+ GenericGenerator generator = this.getSubject().addGenericGenerator();
+ generator.setName(dialog.getName());
+ this.getGenericGeneratorHolder().setValue(generator);//so that it gets selected in the List for the user to edit
+ }
+
+ private ListValueModel<GenericGenerator> buildDisplayableGenericGeneratorsListHolder() {
+ return new ItemPropertyListValueModelAdapter<GenericGenerator>(
+ buildGenericGeneratorsListHolder(),
+ GenericGenerator.NAME_PROPERTY
+ );
+ }
+
+ private AddRemoveListPane<HibernateGeneratorContainer> addListPane(Composite container) {
+
+ return new AddRemoveListPane<HibernateGeneratorContainer>(
+ this,
+ container,
+ buildGenericGeneratorsAdapter(),
+ buildDisplayableGenericGeneratorsListHolder(),
+ this.getGenericGeneratorHolder(),
+ buildGenericGeneratorsListLabelProvider()
+ );
+ }
+
+ private ListValueModel<GenericGenerator> buildGenericGeneratorsListHolder() {
+ return new ListAspectAdapter<HibernateGeneratorContainer, GenericGenerator>(
+ getSubjectHolder(),
+ HibernateGeneratorContainer.GENERIC_GENERATORS_LIST)
+ {
+ @Override
+ protected ListIterator<GenericGenerator> listIterator_() {
+ return (ListIterator<GenericGenerator>) this.subject.genericGenerators();
+ }
+
+ @Override
+ protected int size_() {
+ return this.subject.genericGeneratorsSize();
+ }
+ };
+ }
+
+ private Transformer<GenericGenerator, Control> buildPaneTransformer() {
+ return new Transformer<GenericGenerator, Control>() {
+ public Control transform(GenericGenerator generator) {
+
+ if (generator == null) {
+ return null;
+ }
+
+ return GenericGeneratorsComposite.this.genericGeneratorPane.getControl();
+ }
+ };
+ }
+
+ private Adapter buildGenericGeneratorsAdapter() {
+
+ return new AddRemoveListPane.AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ addGenericGenerator();
+ }
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ for (Object item : listSelectionModel.selectedValues()) {
+ if (item instanceof GenericGenerator) {
+ getSubject().removeGenericGenerator((GenericGenerator) item);
+ }
+ }
+ }
+ };
+ }
+
+
+ private ILabelProvider buildGenericGeneratorsListLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ GenericGenerator generator = (GenericGenerator) element;
+ String name = generator.getName();
+
+ if (name == null) {
+ int index = CollectionTools.indexOf(getSubject().genericGenerators(), generator);
+ name = NLS.bind(HibernateUIMappingMessages.GenericGeneratorsComposite_displayString, Integer.valueOf(index));
+ }
+
+ return name;
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<GenericGenerator> buildGenericGeneratorHolder() {
+ return new SimplePropertyValueModel<GenericGenerator>();
+ }
+
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+ this.listPane.enableWidgets(enabled);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.generatorHolder = buildGenericGeneratorHolder();
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // List pane
+ this.listPane = this.addListPane(container);
+
+ // Property pane
+ PageBook pageBook = new PageBook(container, SWT.NULL);
+ pageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Named GenericGenerator property pane
+ this.genericGeneratorPane = this.buildGenericGeneratorComposite(pageBook);
+
+ installPaneSwitcher(pageBook);
+ }
+
+ protected Pane<? extends GenericGenerator> buildGenericGeneratorComposite(PageBook pageBook) {
+ return new GenericGeneratorComposite(
+ this,
+ this.getGenericGeneratorHolder(),
+ pageBook,
+ buildGenericGeneratorBuilder()
+ );
+ }
+
+ protected GeneratorBuilder<GenericGenerator> buildGenericGeneratorBuilder() {
+ return new GeneratorBuilder<GenericGenerator>() {
+ public GenericGenerator addGenerator() {
+ HibernateJavaGeneratorContainer container = (HibernateJavaGeneratorContainer)getSubject();
+ JavaGenericGenerator generator = container.addGenericGenerator(container.genericGeneratorsSize());
+ generatorHolder.setValue(generator);
+ return generator;
+ }
+ };
+ }
+
+ private void installPaneSwitcher(PageBook pageBook) {
+ new ControlSwitcher(this.getGenericGeneratorHolder(), this.buildPaneTransformer(), pageBook);
+ }
+
+ protected WritablePropertyValueModel<GenericGenerator> getGenericGeneratorHolder() {
+ return generatorHolder;
+ }
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateGenerationComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateGenerationComposite.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateGenerationComposite.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 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,
@@ -15,6 +15,7 @@
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.jpa.core.context.AttributeMapping;
import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
import org.eclipse.jpt.jpa.ui.internal.details.GenerationComposite;
import org.eclipse.jpt.jpa.ui.internal.details.GeneratorComposite.GeneratorBuilder;
@@ -33,13 +34,11 @@
private WritablePropertyValueModel<Boolean> genericGeneratorExpansionStateHolder;
private WritablePropertyValueModel<GenericGenerator> generatorHolder;
- private boolean allowMany;
public HibernateGenerationComposite(Pane<?> parentPane,
PropertyValueModel<? extends HibernateGeneratorContainer> subjectHolder,
- Composite parent, boolean allowMany) {
+ Composite parent) {
super(parentPane, subjectHolder, parent);
- this.allowMany = allowMany;
}
@Override
@@ -89,20 +88,26 @@
null
);
- if (allowMany){
- //FIXME add table with generators
+
+ if (getSubjectHolder().getValue().getParent() instanceof AttributeMapping){
+ if (getSubject().genericGeneratorsSize() > 0){
+ generatorHolder.setValue(getSubject().genericGenerators().next());
+ }
+ // Generic Generator pane
+ this.addGenericGeneratorComposite(
+ container, 0,
+ genericGeneratorCheckBox.getBorderWidth() + 16);
+ } else {
+ addGenericGeneratorsComposite(container, 0,
+ genericGeneratorCheckBox.getBorderWidth() + 16);
}
- //FIXME for many generators
- if (getSubject().genericGeneratorsSize() > 0){
- generatorHolder.setValue(getSubject().genericGenerators().next());
- }
-
- // Generic Generator pane
- this.addGenericGeneratorComposite(
- container, 0,
- genericGeneratorCheckBox.getBorderWidth() + 16);
}
+ protected void addGenericGeneratorsComposite(Composite container, int topMargin, int leftMargin) {
+ new GenericGeneratorsComposite(this, (PropertyValueModel<? extends HibernateGeneratorContainer>) getSubjectHolder(),
+ this.addSubPane(container, topMargin, leftMargin));
+ }
+
protected void addGenericGeneratorComposite(Composite container, int topMargin, int leftMargin) {
new GenericGeneratorComposite(
this,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateIdMappingComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateIdMappingComposite.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateIdMappingComposite.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009-2010 Red Hat, Inc.
+ * Copyright (c) 2009-2011 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,
@@ -69,7 +69,7 @@
protected void initializeGenerationCollapsibleSection(Composite container) {
if (getSubject() instanceof HibernateJavaIdMapping) {
// Generic Generator required only for Java.
- new HibernateGenerationComposite(this, buildGeneratorContainer(), addSubPane(container, 10), false);
+ new HibernateGenerationComposite(this, buildGeneratorContainer(), addSubPane(container, 10));
} else {
super.initializeGenerationCollapsibleSection(container);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2011-08-18 12:10:35 UTC (rev 34042)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Red Hat, Inc.
+ * Copyright (c) 2008-2011 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,
@@ -54,24 +54,18 @@
public static String TypeDefPropertyComposite_Name;
-
-
public static String TypeDefPropertyComposite_TypeClass;
-
-
public static String TypeDefsComposite_Description;
-
-
public static String TypeDefsComposite_DescriptionTitle;
-
-
public static String TypeDefsComposite_dialogTitle;
-
-
public static String TypeDefsComposite_displayString;
-
-
public static String TypeDefsComposite_Name;
+
+ public static String GenericGeneratorsComposite_Description;
+ public static String GenericGeneratorsComposite_DescriptionTitle;
+ public static String GenericGeneratorsComposite_dialogTitle;
+ public static String GenericGeneratorsComposite_displayString;
+ public static String GenericGeneratorsComposite_Name;
private HibernateUIMappingMessages() {}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2011-08-18 12:04:57 UTC (rev 34041)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2011-08-18 12:10:35 UTC (rev 34042)
@@ -32,7 +32,12 @@
TypeDefPropertyComposite_Name=Name:
TypeDefPropertyComposite_TypeClass=Type Class:
TypeDefsComposite_Description=Create a new Type Definition setting 'name'
-TypeDefsComposite_DescriptionTitle=Cerate New Type Definition
+TypeDefsComposite_DescriptionTitle=Create New Type Definition
TypeDefsComposite_dialogTitle=Add Type Definition
TypeDefsComposite_displayString=<Name not set> {0}
TypeDefsComposite_Name=Name:
+GenericGeneratorsComposite_Description=Create a new Generic Generator 'name'
+GenericGeneratorsComposite_DescriptionTitle=Cerate New Generic Generator
+GenericGeneratorsComposite_dialogTitle=Add Generic Generator
+GenericGeneratorsComposite_displayString=<Name not set> {0}
+GenericGeneratorsComposite_Name=Name:
14 years, 8 months
JBoss Tools SVN: r34041 - in trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core: internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-08-18 08:04:57 -0400 (Thu, 18 Aug 2011)
New Revision: 34041
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
Log:
[JBIDE-9513] implemented push to (preconfigured) remote repo. Missing: choose remote repo among several available ones & tests are also missing yet
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-18 11:09:39 UTC (rev 34040)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EgitUtils.java 2011-08-18 12:04:57 UTC (rev 34041)
@@ -10,13 +10,11 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.egit.core;
+import java.io.IOException;
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
-import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -26,33 +24,61 @@
import org.eclipse.egit.core.op.PushOperation;
import org.eclipse.egit.core.op.PushOperationSpecification;
import org.eclipse.egit.core.project.RepositoryMapping;
+import org.eclipse.jgit.errors.NotSupportedException;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.UserConfig;
+import org.eclipse.jgit.transport.RefSpec;
import org.eclipse.jgit.transport.RemoteConfig;
-import org.eclipse.jgit.transport.RemoteRefUpdate;
+import org.eclipse.jgit.transport.Transport;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.as.egit.core.internal.EGitCoreActivator;
+// TODO: Auto-generated Javadoc
/**
+ * The Class EgitUtils.
+ *
* @author André Dietisheim
*/
public class EgitUtils {
+ /** The Constant DEFAULT_PUSH_REF_SPEC. */
+ private static final RefSpec DEFAULT_PUSH_REF_SPEC =
+ new RefSpec("refs/heads/*:refs/heads/*"); //$NON-NLS-1$
+
+ /** The Constant PUSH_TIMEOUT. */
+ private static final int PUSH_TIMEOUT = 10 * 1024;
+
+ /**
+ * Commit.
+ *
+ * @param project the project
+ * @throws CoreException the core exception
+ */
public static void commit(IProject project) throws CoreException {
commit(project, null);
}
+ /**
+ * Commits the given project to it's configured repository.
+ *
+ * @param project the project
+ * @param monitor the monitor
+ * @throws CoreException the core exception
+ */
public static void commit(IProject project, IProgressMonitor monitor) throws CoreException {
-
- IFile[] commitables = new IFile[] {};
- Collection<IFile> untracked = Collections.emptyList();
+ /**
+ * TODO: add capability to commit selectively
+ */
Repository repository = getRepository(project);
UserConfig userConfig = getUserConfig(repository);
CommitOperation op = new CommitOperation(
- commitables,
- null, // committables
- null, // untracked
+ null,
+ null,
+ null,
getSubject(userConfig.getAuthorName(), userConfig.getAuthorEmail()),
getSubject(userConfig.getCommitterName(), userConfig.getCommitterEmail()),
"Initial commit");
@@ -61,53 +87,139 @@
op.execute(monitor);
}
- public static void push(IProject project, Repository destinationRepository) throws CoreException {
- push(project, destinationRepository, null);
- }
-
- public static void push(IProject project, Repository destinationRepository, IProgressMonitor monitor)
+ /**
+ * Push.
+ *
+ * @param project the project
+ * @param monitor the monitor
+ * @throws CoreException the core exception
+ */
+ public static void push(IProject project, IProgressMonitor monitor)
throws CoreException {
- push(getRepository(project), destinationRepository, monitor);
+ push(getRepository(project), monitor);
}
- public static void push(Repository sourceRepository, Repository destinationRepository, IProgressMonitor monitor)
+ /**
+ * Pushes the given repository to it's configured remote.
+ *
+ * @param repository the source repository
+ * @param monitor the monitor
+ * @throws CoreException the core exception
+ */
+ public static void push(Repository repository, IProgressMonitor monitor)
throws CoreException {
try {
- PushOperationSpecification spec = new PushOperationSpecification();
- URIish destinationURIisch = getPushUri(destinationRepository);
- List<RemoteRefUpdate> refUpdates = new ArrayList<RemoteRefUpdate>();
- RemoteRefUpdate update =
- new RemoteRefUpdate(destinationRepository, "HEAD", "refs/heads/test", false, null, null);
- refUpdates.add(update);
- spec.addURIRefUpdates(destinationURIisch, refUpdates);
- PushOperation pop =
- new PushOperation(sourceRepository, spec, false, 0);
+ RemoteConfig remoteConfig = getRemoteConfig(repository);
+ if (remoteConfig == null) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Repository \"{0}\" has no remote repository configured", repository.toString()));
+ throw new CoreException(status);
+ }
+ PushOperation pop = createPushOperation(repository, remoteConfig);
pop.run(monitor);
} catch (Exception e) {
IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
- NLS.bind("Could not push repo {0} to {1}", sourceRepository.toString(),
- destinationRepository.toString()), e);
+ NLS.bind("Could not push repo {0}", repository.toString()), e);
throw new CoreException(status);
}
}
/**
- * Gets the first push uri configured for the given repository or <code>null</code>.
+ * Creates the push operation.
*
+ * @param remoteName the remote name
* @param repository the repository
- * @return the push uri
- * @throws URISyntaxException the uRI syntax exception
+ * @return the push operation
*/
- private static URIish getPushUri(Repository repository) throws URISyntaxException {
-// return new URIish("file:///" + destinationRepository.getDirectory().toString());
- RemoteConfig remoteConfig = new RemoteConfig(repository.getConfig(), "");
- List<URIish> pushURIs = remoteConfig.getPushURIs();
- if (pushURIs == null || pushURIs.isEmpty()) {
- return null;
+ private static PushOperation createPushOperation(String remoteName, Repository repository) {
+ return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
+ }
+
+ /**
+ * Creates the push operation.
+ *
+ * @param repository the repository
+ * @param remoteConfig the remote config
+ * @return the push operation
+ * @throws CoreException the core exception
+ */
+ private static PushOperation createPushOperation(Repository repository, RemoteConfig remoteConfig)
+ throws CoreException {
+
+ PushOperationSpecification spec = new PushOperationSpecification();
+ List<URIish> urisToPush = getPushURIs(remoteConfig);
+ List<RefSpec> pushRefSpecs = getPushRefSpecs(remoteConfig);
+ addURIRefToPushSpecification(urisToPush, pushRefSpecs, repository, spec);
+
+ return new PushOperation(repository, spec, false, PUSH_TIMEOUT);
+ }
+
+ /**
+ * Adds the uri ref to push specification.
+ *
+ * @param urisToPush the uris to push
+ * @param pushRefSpecs the push ref specs
+ * @param repository the repository
+ * @param spec the spec
+ * @throws CoreException the core exception
+ */
+ private static void addURIRefToPushSpecification(List<URIish> urisToPush, List<RefSpec> pushRefSpecs,
+ Repository repository, PushOperationSpecification spec) throws CoreException {
+ for (URIish uri : urisToPush) {
+ try {
+ spec.addURIRefUpdates(uri,
+ Transport.open(repository, uri).findRemoteRefUpdatesFor(pushRefSpecs));
+ } catch (NotSupportedException e) {
+ IStatus status =
+ new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Could not connect repository \"{0}\" to a remote", repository.toString()), e);
+ throw new CoreException(status);
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID, NLS.bind(
+ "Could not convert remote specifications for repository \"{0}\" to a remote",
+ repository.toString()), e);
+ throw new CoreException(status);
+ }
}
- return pushURIs.get(0);
}
+ /**
+ * Gets the push ur is.
+ *
+ * @param remoteConfig the remote config
+ * @return the push ur is
+ */
+ private static List<URIish> getPushURIs(RemoteConfig remoteConfig) {
+ List<URIish> urisToPush = new ArrayList<URIish>();
+ for (URIish uri : remoteConfig.getPushURIs())
+ urisToPush.add(uri);
+ if (urisToPush.isEmpty() && !remoteConfig.getURIs().isEmpty())
+ urisToPush.add(remoteConfig.getURIs().get(0));
+ return urisToPush;
+ }
+
+ /**
+ * Gets the push ref specs.
+ *
+ * @param config the config
+ * @return the push ref specs
+ */
+ private static List<RefSpec> getPushRefSpecs(RemoteConfig config) {
+ List<RefSpec> pushRefSpecs = new ArrayList<RefSpec>();
+ pushRefSpecs.addAll(config.getPushRefSpecs());
+ if (pushRefSpecs.isEmpty()) {
+ // default push to all branches
+ pushRefSpecs.add(DEFAULT_PUSH_REF_SPEC);
+ }
+ return pushRefSpecs;
+ }
+
+ /**
+ * Gets the repository.
+ *
+ * @param project the project
+ * @return the repository
+ */
private static Repository getRepository(IProject project) {
RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
if (repositoryMapping == null) {
@@ -116,11 +228,110 @@
return repositoryMapping.getRepository();
}
+ /**
+ * Gets the user config.
+ *
+ * @param repository the repository
+ * @return the user config
+ */
private static UserConfig getUserConfig(Repository repository) {
return repository.getConfig().get(UserConfig.KEY);
}
+ /**
+ * Gets the subject.
+ *
+ * @param name the name
+ * @param email the email
+ * @return the subject
+ */
private static String getSubject(String name, String email) {
return new StringBuilder().append(name).append(" <").append(email).append('>').toString();
}
+
+ /**
+ * Returns the configuration of the configured remote repository for a given
+ * repository. Returns
+ * <code>null</null> if none was configured or if there's no remote repo configured.
+ *
+ * @param repository
+ * the repository to get the remote repo configuration from
+ * @return the configurtion of the remote repository
+ * @throws CoreException
+ * the core exception
+ */
+ public static RemoteConfig getRemoteConfig(Repository repository) throws CoreException {
+ String branch = null;
+ try {
+ branch = repository.getBranch();
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, EGitCoreActivator.PLUGIN_ID,
+ NLS.bind("Could not get branch on repository \"{0}\"", repository.toString()), e);
+ throw new CoreException(status);
+ }
+
+ String remoteName = getRemoteName(repository, branch);
+ List<RemoteConfig> allRemotes = getRemoteConfigs(repository);
+ return getRemoteConfig(remoteName, allRemotes);
+ }
+
+ /**
+ * Gets the remote config.
+ *
+ * @param remoteName the remote name
+ * @param remoteRepositories the remote repositories
+ * @return the remote config
+ */
+ private static RemoteConfig getRemoteConfig(String remoteName, List<RemoteConfig> remoteRepositories) {
+ RemoteConfig defaultConfig = null;
+ RemoteConfig configuredConfig = null;
+ for (RemoteConfig config : remoteRepositories) {
+ if (config.getName().equals(Constants.DEFAULT_REMOTE_NAME))
+ defaultConfig = config;
+ if (remoteName != null && config.getName().equals(remoteName))
+ configuredConfig = config;
+ }
+
+ if (configuredConfig == null) {
+ return defaultConfig;
+ }
+ return configuredConfig;
+ }
+
+ /**
+ * Gets the remote configs.
+ *
+ * @param repository the repository
+ * @return the remote configs
+ */
+ private static List<RemoteConfig> getRemoteConfigs(Repository repository) {
+ List<RemoteConfig> remoteConfigs = new ArrayList<RemoteConfig>();
+ try {
+ remoteConfigs =
+ RemoteConfig.getAllRemoteConfigs(repository.getConfig());
+ } catch (URISyntaxException e) {
+ remoteConfigs = new ArrayList<RemoteConfig>();
+ }
+ return remoteConfigs;
+ }
+
+ /**
+ * Gets the remote name.
+ *
+ * @param repository the repository
+ * @param branch the branch
+ * @return the remote name
+ */
+ private static String getRemoteName(Repository repository, String branch) {
+ String remoteName;
+ if (ObjectId.isId(branch)) {
+ remoteName = Constants.DEFAULT_REMOTE_NAME;
+ } else {
+ remoteName = repository.getConfig().getString(
+ ConfigConstants.CONFIG_BRANCH_SECTION, branch,
+ ConfigConstants.CONFIG_REMOTE_SECTION);
+ }
+ return remoteName;
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-08-18 11:09:39 UTC (rev 34040)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/internal/EGitCoreActivator.java 2011-08-18 12:04:57 UTC (rev 34041)
@@ -3,30 +3,23 @@
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+
public class EGitCoreActivator implements BundleActivator {
public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.egit.core";
private static BundleContext context;
- static BundleContext getContext() {
+ public static BundleContext getContext() {
return context;
}
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
public void start(BundleContext bundleContext) throws Exception {
EGitCoreActivator.context = bundleContext;
}
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
+
public void stop(BundleContext bundleContext) throws Exception {
EGitCoreActivator.context = null;
}
-
}
14 years, 8 months
JBoss Tools SVN: r34040 - trunk/forge/plugins/org.jboss.tools.forge.runtime.ext.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-08-18 07:09:39 -0400 (Thu, 18 Aug 2011)
New Revision: 34040
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
Log:
JBIDE-9561: try to put all the classes and resources in the 'bin' folder
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 11:06:32 UTC (rev 34039)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 11:09:39 UTC (rev 34040)
@@ -1,6 +1,5 @@
bin.includes = META-INF/,\
- modules/,\
- ./bin/
+ modules/
source../bin/ = src/
output../bin/ = bin/
jars.compile.order = ./bin/
14 years, 8 months
JBoss Tools SVN: r34039 - trunk/forge/plugins/org.jboss.tools.forge.runtime.ext.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-08-18 07:06:32 -0400 (Thu, 18 Aug 2011)
New Revision: 34039
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
Log:
JBIDE-9561: try to put all the classes and resources in the 'bin' folder
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 10:57:07 UTC (rev 34038)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 11:06:32 UTC (rev 34039)
@@ -3,6 +3,4 @@
./bin/
source../bin/ = src/
output../bin/ = bin/
-jars.compile.order = ./bin/,\
- .
-source.. = META-INF/
+jars.compile.order = ./bin/
14 years, 8 months
JBoss Tools SVN: r34038 - in trunk/forge/plugins/org.jboss.tools.forge.runtime.ext: modules/org/jboss/tools/forge/runtime/ext/main and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-08-18 06:57:07 -0400 (Thu, 18 Aug 2011)
New Revision: 34038
Removed:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org.jboss.tools.forge.runtime.ext.jar.index
Modified:
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml
Log:
JBIDE-9561
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 09:05:05 UTC (rev 34037)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/build.properties 2011-08-18 10:57:07 UTC (rev 34038)
@@ -1,5 +1,8 @@
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
- .,\
- modules/
+ modules/,\
+ ./bin/
+source../bin/ = src/
+output../bin/ = bin/
+jars.compile.order = ./bin/,\
+ .
+source.. = META-INF/
Modified: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml 2011-08-18 09:05:05 UTC (rev 34037)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/modules/org/jboss/tools/forge/runtime/ext/main/module.xml 2011-08-18 10:57:07 UTC (rev 34038)
@@ -4,7 +4,6 @@
<resources>
<resource-root path="../../../../../../../../bin" />
- <resource-root path="../../../../../../../.." />
</resources>
<dependencies>
Deleted: trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org.jboss.tools.forge.runtime.ext.jar.index
===================================================================
--- trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org.jboss.tools.forge.runtime.ext.jar.index 2011-08-18 09:05:05 UTC (rev 34037)
+++ trunk/forge/plugins/org.jboss.tools.forge.runtime.ext/src/org.jboss.tools.forge.runtime.ext.jar.index 2011-08-18 10:57:07 UTC (rev 34038)
@@ -1,8 +0,0 @@
-
-META-INF
-org
-org/jboss
-org/jboss/tools
-org/jboss/tools/forge
-org/jboss/tools/forge/runtime
-org/jboss/tools/forge/runtime/ext
14 years, 8 months
JBoss Tools SVN: r34037 - in trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test: quickfix and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-08-18 05:05:05 -0400 (Thu, 18 Aug 2011)
New Revision: 34037
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
Log:
Correction of dependencies
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/quickfix/CDIQuickFixTest.java 2011-08-18 09:05:05 UTC (rev 34037)
@@ -0,0 +1,159 @@
+package org.jboss.tools.cdi.bot.test.quickfix;
+
+import java.util.logging.Logger;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.cdi.bot.test.CDIAllBotTests;
+import org.jboss.tools.cdi.bot.test.uiutils.actions.CDIUtil;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
+import org.jboss.tools.ui.bot.ext.types.ViewType;
+import org.jboss.tools.ui.bot.ext.view.ProblemsView;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/*
+ * Test operates on quick fixes of CDI components
+ *
+ * @author Jaroslav Jankovic
+ */
+
+@Require(perspective = "Java EE", server = @Server(state = ServerState.NotRunning, version = "6.0", operator = ">="))
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ CDIAllBotTests.class })
+public class CDIQuickFixTest extends SWTTestExt {
+
+ private static final Logger LOGGER = Logger.getLogger(CDIQuickFixTest.class.getName());
+ private static final String PROJECT_NAME = "CDIProject";
+ private static final String PACKAGE_NAME = "org.cdi.test";
+
+ @BeforeClass
+ public static void setup() {
+ eclipse.showView(ViewType.PROJECT_EXPLORER);
+ CDIUtil.createAndCheckCDIProject(bot, util, projectExplorer, PROJECT_NAME);
+ }
+
+ @After
+ public void waitForJobs() {
+ util.waitForNonIgnoredJobs();
+ }
+
+ @Test
+ public void testSerializableQF() {
+ CDIUtil.bean(PACKAGE_NAME, "B1", true, false, false, false, null, null,
+ null, null).finish();
+ util.waitForNonIgnoredJobs();
+ SWTBotEditor ed = bot.activeEditor();
+ assertTrue(("B1.java").equals(ed.getTitle()));
+ String code = ed.toTextEditor().getText();
+ LOGGER.fine(code);
+ assertTrue(code.contains("package " + PACKAGE_NAME + ";"));
+ assertTrue(code.contains("public class B1 {"));
+
+ CDIUtil.copyResourceToClass(ed, CDIQuickFixTest.class
+ .getResourceAsStream("/resources/cdi/B1.java.cdi"), false);
+ assertContains("@SessionScoped", ed.toTextEditor().getText());
+ SWTBotTreeItem[] warningTrees = ProblemsView.
+ getFilteredWarningsTreeItems(bot, "Managed bean B1 which", "/"
+ + PROJECT_NAME, "B1.java", "CDI Problem");
+ assertTrue(warningTrees.length == 1);
+
+ CDIUtil.resolveQuickFix(warningTrees[0], bot, util);
+ SWTBotEclipseEditor eclEditor = ed.toTextEditor();
+ assertTrue(eclEditor.getText().contains("import java.io.Serializable;"));
+ warningTrees = ProblemsView.getFilteredWarningsTreeItems(bot,
+ "Managed bean B1 which", "/" + PROJECT_NAME, "B1.java",
+ "CDI Problem");
+ assertTrue(warningTrees.length == 0);
+ }
+
+
+ @Test
+ public void testMultipleBeansQF() {
+ CDIUtil.bean(PACKAGE_NAME, "Animal", true, false, false, false, null,
+ null, null, null).finish();
+ util.waitForNonIgnoredJobs();
+ SWTBotEditor ed = bot.activeEditor();
+ assertTrue(("Animal.java").equals(ed.getTitle()));
+ String code = ed.toTextEditor().getText();
+ assertTrue(code.contains("package " + PACKAGE_NAME + ";"));
+ assertTrue(code.contains("public class Animal {"));
+
+ CDIUtil.bean(PACKAGE_NAME, "Dog", true, false, false, false, null,
+ null, null, null).finish();
+ util.waitForNonIgnoredJobs();
+ ed = bot.activeEditor();
+ CDIUtil.copyResourceToClass(ed, CDIQuickFixTest.class
+ .getResourceAsStream("/resources/cdi/Dog.java.cdi"), false);
+ assertTrue(("Dog.java").equals(ed.getTitle()));
+ code = ed.toTextEditor().getText();
+ LOGGER.fine(code);
+ assertTrue(code.contains("package " + PACKAGE_NAME + ";"));
+ assertTrue(code.contains("public class Dog extends Animal {"));
+
+ CDIUtil.qualifier(PACKAGE_NAME, "Q1", false, false).finish();
+ util.waitForNonIgnoredJobs();
+ ed = bot.activeEditor();
+ assertTrue(("Q1.java").equals(ed.getTitle()));
+ code = ed.toTextEditor().getText();
+ LOGGER.fine(code);
+
+ CDIUtil.bean(PACKAGE_NAME, "BrokenFarm", true, false, false, false, null,
+ null, null, null).finish();
+ util.waitForNonIgnoredJobs();
+ ed = bot.activeEditor();
+ CDIUtil.copyResourceToClass(ed, CDIQuickFixTest.class
+ .getResourceAsStream("/resources/cdi/BrokenFarm.java.cdi"), false);
+ assertTrue(("BrokenFarm.java").equals(ed.getTitle()));
+ code = ed.toTextEditor().getText();
+ LOGGER.fine(code);
+ assertTrue(code.contains("package " + PACKAGE_NAME + ";"));
+ assertTrue(code.contains("public class BrokenFarm {"));
+ assertTrue(code.contains("@Inject private Animal animal;"));
+
+ SWTBotTreeItem[] warningTrees = ProblemsView
+ .getFilteredWarningsTreeItems(bot, "Multiple beans are eligible", "/"
+ + PROJECT_NAME, "BrokenFarm.java", "CDI Problem");
+ assertTrue("Warnings node should contain only one record instead of "
+ + warningTrees.length + " records.", warningTrees.length == 1);
+
+ CDIUtil.openQuickFix(warningTrees[0], bot, util);
+ String qualifBean = null;
+ if (bot.table(0).cell(0, 0).contains("Animal")) {
+ qualifBean = "Animal";
+ }else {
+ qualifBean = "Dog";
+ }
+ bot.activeShell().bot().button("Finish").click();
+ bot.sleep(Timing.time2S());
+ util.waitForNonIgnoredJobs();
+ assertFalse(bot.button("Add >").isEnabled());
+ assertFalse(bot.button("Finish").isEnabled());
+ bot.table(0).click(bot.table(0).indexOf("Q1 - " + PACKAGE_NAME), 0);
+ assertTrue(bot.button("Add >").isEnabled());
+ assertFalse(bot.button("Finish").isEnabled());
+ bot.clickButton("Add >");
+ assertTrue(bot.button("Finish").isEnabled());
+ bot.clickButton("Finish");
+
+ bot.sleep(Timing.time2S());
+ util.waitForNonIgnoredJobs();
+ code = ed.toTextEditor().getText();
+ assertTrue(code.contains("@Inject @Q1 private Animal animal;"));
+ code = bot.editorByTitle(qualifBean + ".java").toTextEditor().getText();
+ assertTrue(code.contains("@Q1"));
+ warningTrees = ProblemsView
+ .getFilteredWarningsTreeItems(bot, "Multiple beans are eligible", "/"
+ + PROJECT_NAME, "BrokenFarm.java", "CDI Problem");
+ assertTrue(warningTrees.length == 0);
+ }
+}
14 years, 8 months
JBoss Tools SVN: r34036 - trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-08-18 05:00:46 -0400 (Thu, 18 Aug 2011)
New Revision: 34036
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
Log:
Comments removed from CDIAllBotTests
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-08-18 08:57:41 UTC (rev 34035)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/CDIAllBotTests.java 2011-08-18 09:00:46 UTC (rev 34036)
@@ -41,8 +41,8 @@
*/
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({
- //CdiATWizardTest.class,
- //BeansEditorTest.class,
+ CdiATWizardTest.class,
+ BeansEditorTest.class,
CDIQuickFixTest.class,
CDIHyperlinksTest.class
})
14 years, 8 months