Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Inglis2003-08-20 16:56:38 -0400
committerDavid Inglis2003-08-20 16:56:38 -0400
commit46969ea9ba604d2dd62264570ee13bf71940d31f (patch)
tree315256d495d9bb5ab6b2760b7a9da0dd9dd18cf8
parentfa4ec73cb8fc566861c278fb66e18c548c7cf027 (diff)
downloadorg.eclipse.cdt-46969ea9ba604d2dd62264570ee13bf71940d31f.tar.gz
org.eclipse.cdt-46969ea9ba604d2dd62264570ee13bf71940d31f.tar.xz
org.eclipse.cdt-46969ea9ba604d2dd62264570ee13bf71940d31f.zip
update make view/action
-rw-r--r--build/org.eclipse.cdt.make.ui/.project2
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif (renamed from build/org.eclipse.cdt.make.ui/icons/obj16/make_target.gif)bin161 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/ctool16/target_rename.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/dtool16/target_rename.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/etool16/target_rename.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/icons/obj16/target.gifbin0 -> 161 bytes
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java17
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeBuilderAction.java20
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeCreateBuildAction.java20
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractMakeBuilderAction.java2
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateBuildAction.java2
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuildAction.java46
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/TargetBuild.java (renamed from build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuild.java)22
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java2
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java30
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java62
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java30
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeContentProvider.java185
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeLabelProvider.java19
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTarget.java139
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTargetAction.java47
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java52
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/RenameTargetAction.java30
31 files changed, 368 insertions, 359 deletions
diff --git a/build/org.eclipse.cdt.make.ui/.project b/build/org.eclipse.cdt.make.ui/.project
index bacedc79cd0..13502de135f 100644
--- a/build/org.eclipse.cdt.make.ui/.project
+++ b/build/org.eclipse.cdt.make.ui/.project
@@ -11,7 +11,7 @@
<project>org.eclipse.cdt.make.core</project>
<project>org.eclipse.cdt.ui</project>
<project>org.eclipse.core.resources</project>
- <project>org.eclipse.ui.workbench</project>
+ <project>org.eclipse.ui</project>
</projects>
<buildSpec>
<buildCommand>
diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/make_target.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif
index 3fc40d6a13a..3fc40d6a13a 100644
--- a/build/org.eclipse.cdt.make.ui/icons/obj16/make_target.gif
+++ b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_add.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_build.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_delete.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/ctool16/target_rename.gif b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_rename.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/ctool16/target_rename.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_add.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_build.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_delete.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/dtool16/target_rename.gif b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_rename.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/dtool16/target_rename.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/etool16/target_add.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/etool16/target_build.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/etool16/target_delete.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/etool16/target_rename.gif b/build/org.eclipse.cdt.make.ui/icons/etool16/target_rename.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/etool16/target_rename.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/icons/obj16/target.gif b/build/org.eclipse.cdt.make.ui/icons/obj16/target.gif
new file mode 100644
index 00000000000..3fc40d6a13a
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/icons/obj16/target.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java
index 5fc7add2f46..48108e68bf8 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/MakeUIImages.java
@@ -21,7 +21,6 @@ public class MakeUIImages {
/**
* Bundle of all images used by the Make plugin.
*/
-
// The plugin registry
private static ImageRegistry imageRegistry = new ImageRegistry();
@@ -40,8 +39,14 @@ public class MakeUIImages {
public static final String OBJ = "obj16/"; //$NON-NLS-1$
// For the build image
- public static final String IMG_OBJS_MAKE_TARGET = NAME_PREFIX + "make_target.gif"; //$NON-NLS-1$
- public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_MAKE_TARGET);
+ public static final String IMG_OBJS_BUILD_TARGET = NAME_PREFIX + "target.gif"; //$NON-NLS-1$
+ public static final ImageDescriptor DESC_BUILD_TARGET = createManaged(OBJ, IMG_OBJS_BUILD_TARGET);
+
+ public static final String IMG_TOOLS_MAKE_TARGET_BUILD = NAME_PREFIX + "target_build.gif"; //$NON-NLS-1$
+ public static final String IMG_TOOLS_MAKE_TARGET_ADD = NAME_PREFIX + "target_add.gif"; //$NON-NLS-1$
+ public static final String IMG_TOOLS_MAKE_TARGET_DELETE = NAME_PREFIX + "target_delete.gif"; //$NON-NLS-1$
+ public static final String IMG_TOOLS_MAKE_TARGET_RENAME = NAME_PREFIX + "target_rename.gif"; //$NON-NLS-1$
+
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
@@ -77,9 +82,9 @@ public class MakeUIImages {
*/
public static void setImageDescriptors(IAction action, String type, String relPath) {
relPath = relPath.substring(NAME_PREFIX_LENGTH);
- action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
- action.setHoverImageDescriptor(create("c" + type, relPath)); //$NON-NLS-1$
- action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
+ action.setDisabledImageDescriptor(create("d" + type + "/", relPath)); //$NON-NLS-1$
+ action.setHoverImageDescriptor(create("c" + type + "/", relPath)); //$NON-NLS-1$
+ action.setImageDescriptor(create("e" + type + "/", relPath)); //$NON-NLS-1$
}
/**
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeBuilderAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeBuilderAction.java
deleted file mode 100644
index accf8650d58..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeBuilderAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created on 18-Aug-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.actions;
-
-import org.eclipse.cdt.make.core.MakeBuilder;
-import org.eclipse.cdt.make.ui.actions.MakeBuildAction;
-
-public class MakeBuilderAction extends MakeBuildAction {
-
- protected String getBuilderID() {
- return MakeBuilder.BUILDER_ID;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeCreateBuildAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeCreateBuildAction.java
deleted file mode 100644
index 2f4423693df..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/actions/MakeCreateBuildAction.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Created on 18-Aug-2003
- *
- * Copyright (c) 2002,2003 QNX Software Systems Ltd.
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.make.internal.ui.actions;
-
-import org.eclipse.cdt.make.core.MakeBuilder;
-import org.eclipse.cdt.make.ui.actions.CreateBuildAction;
-
-public class MakeCreateBuildAction extends CreateBuildAction {
-
- protected String getBuilderID() {
- return MakeBuilder.BUILDER_ID;
- }
-
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractMakeBuilderAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractMakeBuilderAction.java
index a31da3ad587..c48ecfb3e9e 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractMakeBuilderAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/AbstractMakeBuilderAction.java
@@ -41,6 +41,4 @@ public abstract class AbstractMakeBuilderAction extends ActionDelegate implement
return part.getSite().getShell();
}
- protected abstract String getBuilderID();
-
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateBuildAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateBuildAction.java
index 5c3a70b3669..a928492b155 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateBuildAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/CreateBuildAction.java
@@ -12,7 +12,7 @@ import org.eclipse.jface.action.IAction;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-public abstract class CreateBuildAction extends AbstractMakeBuilderAction implements IWorkbenchWindowActionDelegate {
+public class CreateBuildAction extends AbstractMakeBuilderAction implements IWorkbenchWindowActionDelegate {
public void init(IWorkbenchWindow window) {
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuildAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuildAction.java
deleted file mode 100644
index 105e8ce2d5d..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuildAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.make.ui.actions;
-
-import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.views.MakeTarget;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-public abstract class MakeBuildAction extends AbstractMakeBuilderAction {
- protected final String makeActionID = "org.eclipse.cdt.make.ui.makeBuildAction."; //$NON-NLS-1$
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- if (fSelection instanceof IStructuredSelection
- && ((IStructuredSelection) fSelection).getFirstElement() instanceof IProject) {
- IProject project = (IProject) ((IStructuredSelection) fSelection).getFirstElement();
- MakeTarget target = null;
- String id = action.getId();
- if ( id.startsWith(makeActionID) ) {
- String targets = id.substring(makeActionID.length());
- if ( targets.length() > 0) {
-
- }
- };
- if ( target != null ) {
- ProgressMonitorDialog pd = new ProgressMonitorDialog(MakeUIPlugin.getActiveWorkbenchShell());
- MakeBuild.run(true, pd, new MakeTarget[] {target});
- } else {
- MakeUIPlugin.errorDialog(getShell(), "Make Build Contribution Error", "build target not defined", (IStatus)null);
- }
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuild.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/TargetBuild.java
index 313f39bc700..af699009de2 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/MakeBuild.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/TargetBuild.java
@@ -9,13 +9,14 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
-import org.eclipse.cdt.make.ui.views.MakeTarget;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.IEditorInput;
@@ -27,21 +28,21 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.BuildAction;
-public class MakeBuild {
+public class TargetBuild {
/**
* Causes all editors to save any modified resources depending on the user's
* preference.
*/
- static void saveAllResources(MakeTarget[] targets) {
+ static void saveAllResources(IMakeTarget[] targets) {
if (!BuildAction.isSaveAllSet())
return;
List projects = new ArrayList();
for (int i = 0; i < targets.length; ++i) {
- MakeTarget target = targets[i];
- projects.add(target.getResource().getProject());
+ IMakeTarget target = targets[i];
+ projects.add(target.getContainer().getProject());
}
IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
@@ -66,7 +67,7 @@ public class MakeBuild {
}
}
- static public void run(boolean fork, IRunnableContext context, final MakeTarget[] targets) {
+ static public void run(boolean fork, IRunnableContext context, final IMakeTarget[] targets) {
try {
context.run(fork, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
@@ -74,11 +75,10 @@ public class MakeBuild {
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
saveAllResources(targets);
-
-// Map infoMap = new HashMap();
-// IMakeBuilderInfo info = MakeCorePlugin.create(infoMap, MakeBuilder.BUILDER_ID);
-// project.build(IncrementalProjectBuilder.FULL_BUILD, MakeBuilder.BUILDER_ID, infoMap, monitor);
-
+ monitor.beginTask("Building Targets...", targets.length);
+ for( int i = 0; i < targets.length; i++) {
+ targets[i].build(new SubProgressMonitor(monitor, 1));
+ }
}
};
MakeUIPlugin.getWorkspace().run(runnable, monitor);
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java
index 28314f50f2f..fc958da44aa 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/actions/UpdateMakeProjectAction.java
@@ -116,9 +116,9 @@ public class UpdateMakeProjectAction implements IWorkbenchWindowActionDelegate {
new SubProgressMonitor(monitor, 1));
// add new nature
MakeProjectNature.addNature(project[i], new SubProgressMonitor(monitor, 1));
+ IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
QualifiedName qlocation = new QualifiedName(CCorePlugin.PLUGIN_ID, "buildLocation");
String location = project[i].getPersistentProperty(qlocation);
- IMakeBuilderInfo newInfo = MakeCorePlugin.createBuildInfo(project[i], MakeBuilder.BUILDER_ID);
newInfo.setBuildCommand(new Path(location));
//remove old properties
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java
new file mode 100644
index 00000000000..ca40fc7967e
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/AddTargetAction.java
@@ -0,0 +1,30 @@
+package org.eclipse.cdt.make.ui.views;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.make.internal.ui.MakeUIImages;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+
+public class AddTargetAction extends SelectionListenerAction {
+
+ Shell shell;
+ IResource resource;
+
+ public AddTargetAction (Shell shell) {
+ super("Add Build Target");
+ this.shell = shell;
+
+ setToolTipText("Add Build Target");
+ MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_ADD);
+ }
+
+ public void run() {
+
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java
new file mode 100644
index 00000000000..e407057fd51
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/BuildTargetAction.java
@@ -0,0 +1,62 @@
+package org.eclipse.cdt.make.ui.views;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.make.core.IMakeTarget;
+import org.eclipse.cdt.make.internal.ui.MakeUIImages;
+import org.eclipse.cdt.make.ui.actions.TargetBuild;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+public class BuildTargetAction extends SelectionListenerAction {
+
+ Shell shell;
+ IResource resource;
+
+ public BuildTargetAction(Shell shell) {
+ super("Build Target");
+ this.shell = shell;
+
+ setToolTipText("Build Target");
+ MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_BUILD);
+ }
+
+ public void run() {
+ if (canBuild()) {
+ ProgressMonitorDialog pd = new ProgressMonitorDialog(shell);
+ IMakeTarget[] targets = (IMakeTarget[]) getSelectedElements().toArray(new IMakeTarget[0]);
+ TargetBuild.run(true, pd, targets);
+ }
+ }
+
+ protected boolean updateSelection(IStructuredSelection selection) {
+ return super.updateSelection(selection) && canBuild();
+ }
+
+ private boolean canBuild() {
+ List elements = getSelectedElements();
+ if (elements.size() > 0) {
+ Iterator iterator = elements.iterator();
+ while (iterator.hasNext()) {
+ if (!(iterator.next() instanceof IMakeTarget)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ private List getSelectedElements() {
+ return getStructuredSelection().toList();
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java
new file mode 100644
index 00000000000..ddb2443da32
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/DeleteTargetAction.java
@@ -0,0 +1,30 @@
+package org.eclipse.cdt.make.ui.views;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.make.internal.ui.MakeUIImages;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+
+public class DeleteTargetAction extends SelectionListenerAction {
+
+ Shell shell;
+ IResource resource;
+
+ public DeleteTargetAction (Shell shell) {
+ super("Delete Build Target");
+ this.shell = shell;
+
+ setToolTipText("Delete Build Target");
+ MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_DELETE);
+ }
+
+ public void run() {
+
+ }
+}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeContentProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeContentProvider.java
index a70f7ac1a9c..d71e5cf70d1 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeContentProvider.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeContentProvider.java
@@ -5,17 +5,30 @@ package org.eclipse.cdt.make.ui.views;
* All Rights Reserved.
*/
+import java.util.ArrayList;
+import java.util.Arrays;
+
import org.eclipse.cdt.make.core.IMakeTarget;
import org.eclipse.cdt.make.core.IMakeTargetListener;
import org.eclipse.cdt.make.core.MakeCorePlugin;
import org.eclipse.cdt.make.core.MakeTargetEvent;
import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Control;
-public class MakeContentProvider implements ITreeContentProvider, IMakeTargetListener {
- protected Viewer viewer;
+public class MakeContentProvider implements ITreeContentProvider, IMakeTargetListener, IResourceChangeListener {
+ protected TreeViewer viewer;
/**
* Constructor for MakeContentProvider
@@ -23,68 +36,180 @@ public class MakeContentProvider implements ITreeContentProvider, IMakeTargetLis
public MakeContentProvider() {
}
- /**
- * @see ITreeContentProvider#getChildren(Object)
- */
public Object[] getChildren(Object obj) {
- if (obj instanceof IContainer) {
+ if (obj instanceof IWorkspaceRoot) {
+ try {
+ return MakeCorePlugin.getDefault().getTargetProvider().getTargetBuilderProjects();
+ } catch (CoreException e) {
+ }
+ } else if (obj instanceof IContainer) {
+ ArrayList children = new ArrayList();
try {
- return MakeCorePlugin.getDefault().getTargetProvider().getTargets((IContainer)obj);
+ IResource[] resource = ((IContainer) obj).members();
+ for (int i = 0; i < resource.length; i++) {
+ if (resource[i] instanceof IContainer) {
+ children.add(resource[i]);
+ }
+ }
+ children.addAll(Arrays.asList(MakeCorePlugin.getDefault().getTargetProvider().getTargets((IContainer) obj)));
} catch (CoreException e) {
}
+ return children.toArray();
}
return new Object[0];
}
- /**
- * @see ITreeContentProvider#getParent(Object)
- */
public Object getParent(Object obj) {
if (obj instanceof IMakeTarget) {
- return ((IMakeTarget)obj).getContainer();
+ return ((IMakeTarget) obj).getContainer();
} else if (obj instanceof IContainer) {
- return ((IContainer)obj).getParent();
+ return ((IContainer) obj).getParent();
}
return null;
}
- /**
- * @see ITreeContentProvider#hasChildren(Object)
- */
public boolean hasChildren(Object obj) {
return getChildren(obj).length > 0;
}
- /**
- * @see IStructuredContentProvider#getElements(Object)
- */
public Object[] getElements(Object obj) {
return getChildren(obj);
}
- /**
- * @see IContentProvider#dispose()
- */
public void dispose() {
if (viewer != null) {
MakeCorePlugin.getDefault().getTargetProvider().removeListener(this);
}
}
- /**
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (this.viewer == null) {
MakeCorePlugin.getDefault().getTargetProvider().addListener(this);
}
- this.viewer = viewer;
+ this.viewer = (TreeViewer) viewer;
+ IWorkspace oldWorkspace = null;
+ IWorkspace newWorkspace = null;
+ if (oldInput instanceof IWorkspace) {
+ oldWorkspace = (IWorkspace) oldInput;
+ } else if (oldInput instanceof IContainer) {
+ oldWorkspace = ((IContainer) oldInput).getWorkspace();
+ }
+ if (newInput instanceof IWorkspace) {
+ newWorkspace = (IWorkspace) newInput;
+ } else if (newInput instanceof IContainer) {
+ newWorkspace = ((IContainer) newInput).getWorkspace();
+ }
+ if (oldWorkspace != newWorkspace) {
+ if (oldWorkspace != null) {
+ oldWorkspace.removeResourceChangeListener(this);
+ }
+ if (newWorkspace != null) {
+ newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
+ }
+ }
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.make.core.IMakeTargetListener#targetChanged(org.eclipse.cdt.make.core.MakeTargetEvent)
- */
- public void targetChanged(MakeTargetEvent event) {
-
+ public void targetChanged(final MakeTargetEvent event) {
+ final Control ctrl = viewer.getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ switch (event.getType()) {
+ case MakeTargetEvent.PROJECT_ADDED :
+ case MakeTargetEvent.PROJECT_REMOVED :
+ ctrl.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (ctrl != null && !ctrl.isDisposed()) {
+ viewer.refresh();
+ }
+ }
+ });
+ break;
+ case MakeTargetEvent.TARGET_ADD :
+ case MakeTargetEvent.TARGET_CHANGED :
+ case MakeTargetEvent.TARGET_REMOVED :
+ ctrl.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ if (ctrl != null && !ctrl.isDisposed()) {
+ viewer.refresh(event.getTarget().getContainer());
+ }
+ }
+ });
+ break;
+ }
+ }
+ }
+
+ void processDelta(IResourceDelta delta) {
+ // Bail out if the widget was disposed.
+ Control ctrl = viewer.getControl();
+ if (ctrl == null || ctrl.isDisposed() || delta == null) {
+ return;
+ }
+
+ // Get the affected resource
+ IResource resource = delta.getResource();
+ IResourceDelta[] affectedChildren = delta.getAffectedChildren(IResourceDelta.CHANGED);
+
+ // Not interested in Content changes.
+ for (int i = 0; i < affectedChildren.length; i++) {
+ if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) {
+ return;
+ }
+ }
+
+ // Handle changed children recursively.
+ for (int i = 0; i < affectedChildren.length; i++) {
+ processDelta(affectedChildren[i]);
+ }
+
+ // Handle removed children. Issue one update for all removals.
+ affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
+ if (affectedChildren.length > 0) {
+ ArrayList affected = new ArrayList(affectedChildren.length);
+ for (int i = 0; i < affectedChildren.length; i++) {
+ if (affectedChildren[i].getResource() instanceof IContainer) {
+ affected.add(affectedChildren[i].getResource());
+ }
+ }
+ if (affected.size() != 0) {
+ if (viewer instanceof AbstractTreeViewer) {
+ ((AbstractTreeViewer) viewer).remove(affected.toArray());
+ } else {
+ ((StructuredViewer) viewer).refresh(resource);
+ }
+ }
+ }
+
+ // Handle added children. Issue one update for all insertions.
+ affectedChildren = delta.getAffectedChildren(IResourceDelta.ADDED);
+ if (affectedChildren.length > 0) {
+ ArrayList affected = new ArrayList(affectedChildren.length);
+ for (int i = 0; i < affectedChildren.length; i++) {
+ if (affectedChildren[i].getResource() instanceof IContainer) {
+ affected.add(affectedChildren[i].getResource());
+ }
+ }
+ if (affected.size() != 0) {
+ if (viewer instanceof AbstractTreeViewer) {
+ ((AbstractTreeViewer) viewer).add(resource, affected.toArray());
+ } else {
+ ((StructuredViewer) viewer).refresh(resource);
+ }
+ }
+ }
+ }
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ final IResourceDelta delta = event.getDelta();
+ Control ctrl = viewer.getControl();
+ if (ctrl != null && !ctrl.isDisposed()) {
+ // Do a sync exec, not an async exec, since the resource delta
+ // must be traversed in this method. It is destroyed
+ // when this method returns.
+ ctrl.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ processDelta(delta);
+ }
+ });
+ }
}
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeLabelProvider.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeLabelProvider.java
index b6a19c5f916..e74012bdf39 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeLabelProvider.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeLabelProvider.java
@@ -10,20 +10,19 @@ import org.eclipse.cdt.make.internal.ui.MakeUIImages;
import org.eclipse.core.resources.IContainer;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
public class MakeLabelProvider extends LabelProvider {
-
+ WorkbenchLabelProvider fLableProvider = new WorkbenchLabelProvider();
/**
* @see ILabelProvider#getImage(Object)
*/
public Image getImage(Object obj) {
Image image = null;
if (obj instanceof IMakeTarget) {
- return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKE_TARGET);
+ return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_BUILD_TARGET);
} else if (obj instanceof IContainer) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+ return fLableProvider.getImage(obj);
}
return image;
}
@@ -32,11 +31,17 @@ public class MakeLabelProvider extends LabelProvider {
* @see ILabelProvider#getText(Object)
*/
public String getText(Object obj) {
- if (obj instanceof MakeTarget) {
+ if (obj instanceof IMakeTarget) {
return ((IMakeTarget)obj).getName();
} else if (obj instanceof IContainer) {
- return ((IContainer)obj).getName();
+ return fLableProvider.getText(obj);
}
return ""; //$NON-NLS-1$
}
+
+ public void dispose() {
+ super.dispose();
+ fLableProvider.dispose();
+ }
+
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTarget.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTarget.java
deleted file mode 100644
index 2fb19c0734a..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTarget.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-
-import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-
-/**
- * A leaf is a IResource with a Make Directive.
- * We use the term Directive instead of Make Targets
- * to not confuse with remote targets.
- */
-
-public class MakeTarget implements IAdaptable {
-
- private static final MakeTarget[] emptyArray= new MakeTarget[0];
- private IResource resource;
- private String target;
-
- public MakeTarget(IResource res) {
- this(res, "");
- }
-
- public MakeTarget(IResource res, String goals) {
- resource = res;
- target = (goals == null) ? "" : goals;
- }
-
- /**
- * @see IAdaptable#getAdapter(Object)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IResource.class) {
- return resource;
- }
- return null;
- }
-
- /**
- */
- public MakeTarget[] getChildren() {
- if (resource != null && target.length() == 0) {
- ArrayList list = new ArrayList();
- if (resource instanceof IWorkspaceRoot) {
- IWorkspaceRoot root = (IWorkspaceRoot)resource;
- IProject [] projects = root.getProjects();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i].isOpen()) {
- try {
- if (projects[i].hasNature(CProjectNature.C_NATURE_ID)) {
- list.add (new MakeTarget(projects[i]));
- }
- } catch (CoreException e) {
- }
- }
- }
- } else if (resource instanceof IContainer) {
- IContainer container = (IContainer)resource;
- try {
- IResource[] resources = container.members();
- for (int i = 0; i < resources.length; i++) {
- if (resources[i] instanceof IContainer) {
- list.add (new MakeTarget(resources[i]));
- }
- }
- } catch (CoreException e) {
- }
-// String [] targets = MakeUtil.getPersistentTargets(resource);
-// for (int i = 0; i < targets.length; i++) {
-// if (targets[i] == null)
-// targets[i] = "";
-// list.add (new MakeTarget(resource, targets[i]));
-// }
- }
- return (MakeTarget[])list.toArray(emptyArray);
- }
- return emptyArray;
- }
-
- /**
- */
- public MakeTarget getParent() {
- if (target.length() == 0)
- return new MakeTarget(resource.getParent());
- return new MakeTarget(resource);
- }
-
- public String toString() {
- if (target.length() == 0)
- return resource.getName();
- return target;
- }
-
- public ImageDescriptor getImageDescriptor() {
- if (isLeaf()) {
- return CPluginImages.DESC_BUILD_MENU;
- }
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable)resource).getAdapter(IWorkbenchAdapter.class);
- if (adapter == null)
- return null;
- return adapter.getImageDescriptor(resource);
- }
-
- public IResource getResource () {
- return resource;
- }
-
- public boolean isLeaf () {
- return (target.length() != 0);
- }
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals(Object obj) {
- if (null == obj)
- return false;
-
- if (!(obj instanceof MakeTarget))
- return false;
-
- MakeTarget other = (MakeTarget)obj;
- return (resource.equals(other.resource) && target.equals(other.target));
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTargetAction.java
deleted file mode 100644
index c837d63816c..00000000000
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeTargetAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.cdt.make.ui.views;
-
-/*
- * (c) Copyright QNX Software Systems Ltd. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.cdt.internal.ui.CPluginImages;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class MakeTargetAction extends Action {
-
- Shell shell;
- IResource resource;
-
- public MakeTargetAction (Shell shell) {
- super("Add Make Targets");
- this.shell = shell;
-
- setToolTipText("BuildAction");
- setImageDescriptor(CPluginImages.DESC_BUILD_MENU);
- }
-
- public void run() {
- InputDialog dialog = new InputDialog(shell, "Target Dialog: ", "Enter Target(s): ", null, null);
- dialog.open();
- //String value = dialog.getValue();
-// if (value != null && value.length() > 0) {
-// if (resource != null)
-// MakeUtil.addPersistentTarget(resource, value);
-// }
- }
-
- public void selectionChanged(IStructuredSelection selection) {
- Object obj = (IAdaptable)selection.getFirstElement();
- if (obj instanceof IAdaptable) {
- IAdaptable element = (IAdaptable)obj;
- resource = (IResource)element.getAdapter(IResource.class);
- }
- }
-}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
index e98b9a8376e..1f4f131967d 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/MakeView.java
@@ -5,7 +5,7 @@ package org.eclipse.cdt.make.ui.views;
* All Rights Reserved.
*/
-import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
@@ -23,11 +23,16 @@ import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.ViewPart;
public class MakeView extends ViewPart {
+ private BuildTargetAction buildTargetAction;
+ private RenameTargetAction renameTargetAction;
+ private DeleteTargetAction deleteTargetAction;
+ AddTargetAction addTargetAction;
TreeViewer viewer;
DrillDownAdapter drillDownAdapter;
@@ -73,7 +78,7 @@ public class MakeView extends ViewPart {
viewer.setContentProvider(new MakeContentProvider());
viewer.setLabelProvider(new MakeLabelProvider());
- viewer.setInput(MakeCorePlugin.getDefault().getTargetProvider());
+ viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
getSite().setSelectionProvider(viewer);
makeActions();
@@ -82,8 +87,10 @@ public class MakeView extends ViewPart {
}
private void makeActions() {
- // dinglis-TODO Auto-generated method stub
-
+ buildTargetAction = new BuildTargetAction(viewer.getControl().getShell());
+ addTargetAction = new AddTargetAction(viewer.getControl().getShell());
+ deleteTargetAction = new DeleteTargetAction(viewer.getControl().getShell());
+ renameTargetAction = new RenameTargetAction(viewer.getControl().getShell());
}
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
@@ -93,6 +100,7 @@ public class MakeView extends ViewPart {
private void fillLocalToolBar(IToolBarManager toolBar) {
drillDownAdapter.addNavigationActions(toolBar);
+ toolBar.add(buildTargetAction);
}
private void fillLocalPullDown(IMenuManager manager) {
@@ -110,50 +118,38 @@ public class MakeView extends ViewPart {
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
+// getSite().registerContextMenu(menuMgr, viewer);
}
protected void fillContextMenu(IMenuManager manager) {
-// manager.add(deleteAction);
-// manager.add(renameAction);
+ manager.add(buildTargetAction);
+ manager.add(addTargetAction);
+ manager.add(deleteTargetAction);
+ manager.add(renameTargetAction);
manager.add(new Separator());
drillDownAdapter.addNavigationActions(manager);
+
// Other plug-ins can contribute there actions here
- manager.add(new Separator("Additions"));
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
protected void handleDeleteKeyPressed() {
- // dinglis-TODO Auto-generated method stub
-
+ deleteTargetAction.run();
}
-
protected void handleDoubleClick(DoubleClickEvent event) {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- //System.out.println ("Double click on " + element);
- if (element instanceof MakeTarget) {
- MakeTarget ta = (MakeTarget) element;
-// Action build = new MakeBuildAction(new MakeTarget[] { ta }, getViewSite().getShell(), "Build");
-// build.run();
- }
- //if (viewer.isExpandable(element)) {
- // viewer.setExpandedState(element, !viewer.getExpandedState(element));
- //}
+ buildTargetAction.run();
}
void handleSelectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
-// updateStatusLine(sel);
updateActions(sel);
}
void updateActions(IStructuredSelection sel) {
-// deleteAction.selectionChanged(sel);
-// renameAction.selectionChanged(sel);
+ buildTargetAction.selectionChanged(sel);
+ deleteTargetAction.selectionChanged(sel);
+ renameTargetAction.selectionChanged(sel);
}
-
-
-
}
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/RenameTargetAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/RenameTargetAction.java
new file mode 100644
index 00000000000..6f15c7f7d81
--- /dev/null
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/ui/views/RenameTargetAction.java
@@ -0,0 +1,30 @@
+package org.eclipse.cdt.make.ui.views;
+
+/*
+ * (c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.cdt.make.internal.ui.MakeUIImages;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.actions.SelectionListenerAction;
+
+
+public class RenameTargetAction extends SelectionListenerAction {
+
+ Shell shell;
+ IResource resource;
+
+ public RenameTargetAction (Shell shell) {
+ super("Rename Build Target");
+ this.shell = shell;
+
+ setToolTipText("Rename Build Target");
+ MakeUIImages.setImageDescriptors(this, "tool16", MakeUIImages.IMG_TOOLS_MAKE_TARGET_RENAME);
+ }
+
+ public void run() {
+
+ }
+}

Back to the top